Rsync: --link-dest when target and compare_dir both have file
jw schultz
jw at pegasys.ws
Tue Jun 3 08:49:56 EST 2003
On Mon, Jun 02, 2003 at 03:32:04PM -0700, Michael Rubel wrote:
> Hi J.W.,
>
> Please pardon this intrusion on your private address; the rsync list seems
> to be down (no messages since yesterday), so I'm forwarding this directly
> to you. If you'd rather wait until the list restarts, that's fine too.
I'm CCing the list.
>
> Best regards,
> Mike
>
> ---------- Forwarded message ----------
> Date: Mon, 2 Jun 2003 09:56:50 -0700 (PDT)
> From: Michael Rubel <mrubel at galcit.caltech.edu>
> To: rsync at lists.samba.org
> Subject: --link-dest when target and compare_dir both have file
>
> Hi J.W. et al,
>
> Kevin Everets was kind enough to inform me about some strange behavior in
> his backup script, which seems to be the result of --link-dest behaving
> unexpectedly in the case where target/ is already populated with older
> versions of the same file.
>
> Here's the situation:
>
> We want to do:
> $ rsync -a --link-dest=../backup.1 source/ backup.0/
>
> There is a file present under all three directories. Suppose that it the
> version in backup.1/ is identical to the version in source/, and that
> backup.0/ contains an older version.
>
> In this case, I would expect:
> 1. the version in backup.0 should be unlinked
> 2. a new hard link should be created in backup.0/ to the copy in backup.1/
>
> In fact, rsync (at least as of 2.5.6) seems to copy the full file:
--link-dest is built on --compare-dest and behaves like
--compare-dest as indicated in the manpage.
Observe the description of --compare-dest (ALLCAPS added for
emphasis):
This option instructs rsync to use DIR on the des
tination machine as an additional directory to com
pare destination files against when doing transfers
IF THE FILES ARE MISSING IN THE DESTINATION DIREC
TORY.
In other words, the files in the --link-dest location will
only be used if there is no existing file in the
destination. The best way to use --link-dest is to have an
empty destination.
For a link-dest based rotating backup that reuses directory
names the best bet is to do a "rm -r $dest; mkdir $dest" or
to "rsync -a --link-dest=../backup.1 $source temp; mv temp
backup.0"
--
________________________________________________________________
J.W. Schultz Pegasystems Technologies
email address: jw at pegasys.ws
Remember Cernan and Schmitt
More information about the rsync
mailing list