PrintLogo

Rsync Over a Flakey Connection




By default, rsync will start the sync of a particular file over again if the connection is lost. Use the --inplace option if the sync is getting hung up on a large file:

rsync -e 'ssh -p sshport' -av --inplace /source/ root@example.com:/dest/

Since the problem file is compressed, it does no good to use -avz, so we just used -av. In this particular example, we do not have the --delete option. This can be useful if you are doing multiple rsyncs: a full one, and more selective ones with just the smaller files. That is, you could move the large files away, and do a sync to get as many file in place for the restore as quickly as possible, but run a more complete sync in parallel. If the --delete option is used, then the big files will get deleted if they exist at the destination. Here is a command that uses compression and delete without the --inplace options:

rsync -e 'ssh -p sshport' --delete -avz --exclude "/ex/" root@example.com:/ /dst/

This command will sync up the root directory with the local /dst/ directory, use compression, and will delete files in the /dst/ directory that were not in the root of root@example.com. It excludes all files in the /ex/ directory.



This article comes from NetAdminTools:
http://www.netadmintools.com/

The URL for this story is:
http://www.netadmintools.com/art502.html

Copyright 1997-2008 NetAdminTools.com. Read our Terms of Use.