[BBLISA] Help with backups

Steve Revilak srevilak at speakeasy.net
Fri Aug 17 23:02:52 EDT 2007


> Date: Fri, 17 Aug 2007 20:56:20 -0400 (EDT)
> From: Scott Ehrlich
> Subject: [BBLISA] Help with backups

> Trying tar cvf /mnt/samba_share/backup.tar /* eventually yields backing up 
> /mnt, which produces an unwanted loop, including /mnt/samba_share
>
> I looked at tar with --exclude /mnt but didn't seem to get the results I 
> wanted.
   ...
> What do people suggest?

For backups, I tend to like rsync more than tar.  The first time you
make a backup, both will move the same amount of data.  On subsequent
(incremental) backups, rsync tends to be much faster since it only
copies files that have changed.  Of course, that assumes the target
device is a hard drive, and that you'll have more unchanged than
changed files.

You might try

   mkdir /mnt/samba_share/`hostname`
   rsync --backup --archive --verbose -n --one-file-system \
       /. /mnt/samba_share/`hostname`

The -n option means "dry-run" -- rsync will just show you what it
wants to copy.  Remove the -n and rsync will do the real work.

Another strategy I've found useful is

   find [directory] [find options to select files you're interested in] | \
     egrep -v [expression to eliminate files you're not interested in] \
      > /tmp/filelist.txt

   rsync --archive --files-from=/tmp/filelist.txt /destination/directory/

This allows you to use rsync in some cases that you normally wouldn't.
For example, you can do -mtime based backups (or anything that can be
expressed with find's selection predicates).  We do something like
this for long-term log archival.

Steve









More information about the bblisa mailing list