[PLUG] Looking for the right rsync command...

Carlos Konstanski ckonstanski at pippiandcarlos.com
Thu Dec 11 17:01:04 UTC 2008


On Thu, 11 Dec 2008, robinson-west user wrote:

> Date: Thu, 11 Dec 2008 08:38:19 +0000
> From: robinson-west user <plug_1 at robinson-west.com>
> To: plug at lists.pdxlinux.org
> Subject: [PLUG] Looking for the right rsync command...
> 
> rsync -HpogD --exclude /proc --exclude /tmp -exclude /backup -
> alrv / /backup/remote_backup/goose_live/
>
> I want to mirror my live Linux filesystem to another hard drive on a
> remote system.  Can rsync do this for me or is it not compatible with
> files that are changing?

rsync does not "freeze" the filesystem to get a true snapshot in time.
It merely copies files as it comes to them.  One technique that works
reasonably well is to run the command twice.  The second time it will
run a lot faster, thereby narrowing the window of time between the
beginning and end of the command's runtime greatly.

You can get rid of -HpogDlr.  You only need -a, and if you want
verbosity -v, and if you want more verbosity --progress.

I usually use --exclude-from, and put the file in /etc.  My file looks
like this:

/proc
/tmp
/var/tmp/portage
/sys

I'm thinking that /proc and /sys are mount points:

/proc on /proc type proc (rw,nodiratime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec)

I would exclude /dev too, if I were sure that there were no persistent
device nodes.  But I'm not.

Even on a busy server, there is probably only small spots on the
filesystem that are changing all that much.  rsync will race right
through those.  but it won't be a perfect snapshot in time.  If that
is what you need, maybe LVM2 snapshots?

Carlos



More information about the PLUG mailing list