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

Sean Hammond sean.hammond at gmail.com
Thu Dec 29 03:37:01 GMT 2005

I'm using rsync to keep 3 copies of a folder named 'sync' synchronised.
There is one remote copy, and two machines that I work on that have local
copies. I try to always upload work from one machine to the remote copy
before doing some work on another machine, otherwise I just merge things

Here is my entire rsync command for backing up from either of the work
machines to the remote host:

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

In particular I am passing rsync these two options:

-b --backup-dir=backup

This caused rsync to create, on the remote machine, a folder named backup
inside the folder sync. I was a little worried about the backup folder being
inside the sync folder. But indeed rsync seemed to copy into this backup
folder any files from the remote end that got changed or deleted during a
synchronisation. So far, as expected. Then (after successive
synchronisations over time) rsync started creating backup folders insider
the backup folder (recursively). It looked like on each synchronisation
rsync moved the current remote backup folder to remote:sync/backup/backup
(and did this recursively so that an existing /backup/backup folder becomes
/backup/backup/backup/, and so on) and then it puts any new backup files
into sync/backup/. Okaaay... so it's maintaining multiple backups, good, but
I said to myself that I would have to go into the remote host every now and
then and delete some of the older backups so I don't go over my quota. In
further runs of rsync I noticed however that it was deleting things from the
backup folders. It seems as if it's maintaining a set number of backups,
three of four deep or something (I just checked and it goes five deep on my
remote host right now, to backup/backup/backup/backup/backup/), and
automatically deleting backups older than that. Am I right? Or have I done
something wrong with my command?

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? i.e. when
rysnc'ing from a remote host to the local machine, you should pass -t so
that the times are preserved in the new files on the local host? And that
option should be used every time you rsync either to or from the remote

Finally when running backups from this new machine, rsync keeps feezing. At
different points in the backup it just freezes for a long time and I
eventually have to kill it. I have verbose output on but that shows nothing,
the output just stops coming. It seems to be perfectly safe to kill rsync in
mid-run and then re-run the command and hope it works. Is this safe?

Sean's mailing list bin
-------------- next part --------------
HTML attachment scrubbed and removed

More information about the rsync mailing list