Rsync and snapshot backups

Matt McCutchen matt at
Tue Nov 20 19:56:34 GMT 2007

On Tue, 2007-11-20 at 14:24 -0500, Steve wrote:
> I'm currently using rsync to backup home directories using this:
> rsync -avx --delete --backup --backup-dir=/u1/home.bak /u0/home/
> /u1/home >> ${log}
> I'm trying to move to snapshot backups using this:
> rsync -avx --delete --backup --backup-dir=/u1/home.bak
> --link-dest=../home.current /u0/home/ /u1/home_${datetime} >> ${log}
> This works except I no longer get deleted source files moved to
> backup-dir.  Is there a way to get this behavior with the link-dest
> feature?

No, because rsync only backs up files from the destination and your
destination is now a new, empty directory instead of the previous

You can already recover files from previous snapshots; are you sure you
also want a backup dir?  If so, the best way I can think of to achieve
this is to fill /u1/home_${datetime} with hard links
from /u1/home.current using "cp -al" and then run the rsync command
without the --link-dest option.  To ensure that rsync does not corrupt
attributes as seen through old snapshots, I recommend that you use a
copy of rsync with this patch:

and pass the --no-tweak-hlinked option.


More information about the rsync mailing list