[nmglug] Backups

J. Marsden DeLapp jmdelapp at delapp.com
Sat May 16 10:28:26 PDT 2015


On Fri, 15 May 2015 17:20:37 -0600
a <a at kaluta.us> wrote:

> can you give me an idea of the corrected code  there a few mail 
> directories I wish to save.would saving these be sufficient to
> transfer contents to new reload?

I like to use rsync for backups. cp -a is good for a file or two. rsync
is way better to backup up directories. And rsync works well for
restoring from backups.;

Here is a simple example

First I do a dry run to see what will happen, especially important when
using --delete.
rsync -havn /home/me/ /backup/home/me/ --delete --exclude=*.iso

Then get rid of the n option to actually do it.
rsync -hav /home/me/ /backup/home/me/ --delete --exclude=*.iso


And for extra credit, here is a more complex example from a backup
script file.

rsync -hav  $task $dest$task --backup --backup-dir=$bkupdest$task
--exclude-from=$whatnottobackup --delete --one-file-system
--numeric-ids --delete-excluded

Where $task is something like
/etc/
/home/me/
/var/www/

$dest$task is something like
/backup/hostname/current/etc/

$bkupdest$task is something like
/backup/hostname/2015-05/16/etc/

$whatnottobackup is a file that includes things like
#exclude.txt file
*.SV$
*.bak
*.iso
/var/cache/apt/archives
Trash/
trash/


Mars

-- 
=============================================================
J. Marsden DeLapp, PE
President
DeLapp & Associates, Inc. dba DeLapp Engineering.
Providing lighting and power planning, design and analysis services
for commercial, industrial and large residential facilities.
1190 Harrison Road Ste 3a
Santa Fe NM 87507
(505) 983-5557
http://DeLapp.com
=============================================================


More information about the nmglug mailing list