-b and --backup-dir options, should backup-dir be INSIDE the sync'd folder?

Wayne Davison wayned at samba.org
Fri Dec 30 06:15:36 GMT 2005

On Thu, Dec 29, 2005 at 03:37:01AM +0000, Sean Hammond wrote:
> I'm using rsync to keep 3 copies of a folder named 'sync' synchronised.

You might want to check into using unison for that (or even using a
version control program, such as cvs).

> rsync -r -b --backup-dir=backup --delete -z -i --progress sync/ user at host:sync/

You'd be better off putting the backup dir outside the transfer by using
something like --backup-dir=../backup .  If that is not possible, you
should exclude the backup dir from the deletion pass (and also from the
files being copied) by using:


> Also I noticed that when I 'checked out' a copy of the remote folder onto a
> new machine and then used rsync to backup back to the remote host, it copied
> every single file. I think this may be because I should have 'checked out'
> the copy in the first place using rsync with the --times option?

Yes, that would do it.  You need to either always use -t (to make the
quick-check always work) or use -c (which is a better but slower check
to find the files that have actually changed).

> Finally when running backups from this new machine, rsync keeps feezing.

I wonder if that might be caused by rsync deleting a file in the backup
dir over and over again.  You can use a command such as strace on the
program to know for sure.


More information about the rsync mailing list