Hi! It's me again with another --link-dest issue: I am using dirvish (www.dirvish.org) to create daily backup on disk images. dirvish is using rsync with --link-dest pointing to the last good image. This creates images with hardlinks to unmodified files. So far so good. Now I want to create a "current" filetree with hardlinks pointing to the last image. rsync -vaH --delete --stats --numeric-ids -x --link-dest=/path/to/lastimg /path/to/lastimg /path/to/current This works except when an existing file has been modified and is now "new" (and not the n'th hardlink) in the image. This file is copied to the "current" directory. A hardlink pointing to the file in lastimg is not created. If a new file has been created in between the dirvish runs it perfectly gets hardlinked in the "current" directory. Is that intented behaviour? You can easily reproduce the issue with the following commands: # create source dir mkdir -p /tmp/rsync/src # create 1st file echo 1 > src/a # create 1st "backup" image rsync -vaH --delete --numeric-ids -x /tmp/rsync/src/ /tmp/rsync/1/ # create "current" dir with hardlinks from 1st image rsync -vaH --delete --numeric-ids -x --link-dest=/tmp/rsync/1/ /tmp/rsync/1/ /tmp/rsync/current/ # create 2nd file echo 2 > src/b # create 2nd image rsync -vaH --delete --numeric-ids -x --link-dest=/tmp/rsync/1/ /tmp/rsync/src/ /tmp/rsync/2/ # create "current" with hardlinks from 2nd image rsync -vaH --delete --numeric-ids -x --link-dest=/tmp/rsync/2/ /tmp/rsync/2/ /tmp/rsync/current/ # modify 1st file echo 3 >> src/a # create 3rd image rsync -vaH --delete --numeric-ids -x --link-dest=/tmp/rsync/2/ /tmp/rsync/src/ /tmp/rsync/3/ # create "current" with hardlinks from 3rd image rsync -vaH --delete --numeric-ids -x --link-dest=/tmp/rsync/3/ /tmp/rsync/3/ /tmp/rsync/current/ The last call to rsync will not re-create the hardlinked file "a" but will create a new copy of "a" in the "current" directory. If "current" is removed and re-created: rm -rf current rsync -vaH --delete --numeric-ids -x --link-dest=/tmp/rsync/3/ /tmp/rsync/3/ /tmp/rsync/current/ both files "a" and "b" are hardlinks pointing to the 3rd image. Greetings -- Robert Sander
On Tue, Jan 23, 2007 at 01:41:55PM +0000, it-rsync@ml.epigenomics.com wrote:> This works except when an existing file has been modified and is now > "new" (and not the n'th hardlink) in the image. This file is copied to > the "current" directory. A hardlink pointing to the file in lastimg is > not created.That's exactly right. Rsync never looks for an alternate file when a destination file exists. It is expected that the --link-dest option will be used with an empty hierarchy of files, otherwise it will be sub-optimal, and any attribute changes it makes can affect the older, hard-linked file versions, which is not usually what you want. You're better off maintaining a symlink named "current" that points to the most recent directory. Either that, or rename the dirs after the transfer. ..wayne..