Hi I have a problem with rsync and the -c option. I think understand what it does, but I'm not sure, it does it correctly. But then I guess, perhaps I don't understand what it does... :-) I use "rsync version 2.6.8 protocol version 29" I use the following command: /opt/rsync/bin/rsync -av --link-dest=/home/user/backup/old /home/user/source /home/user/backup/new This works ok. If I touch a file in the source directory, I get a copy in the 'backup/new' directory, all the other files there are hard linked to 'backup/old'. This is still ok and how I expected rsync to work (as the one file changed it's timestamp). If added '-c' to the already existing '-a'. Now it looks as follows: /opt/rsync/bin/rsync -cav --link-dest=/home/user/backup/old /home/user/source /home/user/backup/new I expected, that rsync doesn't care about the timestamp anymore. It should calc the checksum of all the files in the source directory, compares them with the files in the '--link-dest' directory and just copies the files with a different checksum. But there is no change in the behavior of rsync. I get the same result with or without the '-c' option. My guess: --checksum does not work on --link-dest. Is this by design? Any help on this (and is it clear, what I have in mind)? Thanks, Andreas
On Mon 22 May 2006, Andreas Fehr wrote:> > If added '-c' to the already existing '-a'. Now it looks as follows: > > /opt/rsync/bin/rsync -cav > --link-dest=/home/user/backup/old > /home/user/source > /home/user/backup/new > > > I expected, that rsync doesn't care about the timestamp anymore. It > should calc the checksum of all the files in the source directory, > compares them with the files in the '--link-dest' directory and just > copies the files with a different checksum. But there is no change in > the behavior of rsync. I get the same result with or without the '-c' > option. > > My guess: --checksum does not work on --link-dest. Is this by design?It does, but not the way you expect it. The -a also implies -t, so you're telling rsync to preserve timestamps. The only way it can do that is by creating a new file, as the --link-dest tree has a different timestamp. The --checksum will only _increase_ the number of newly created files, if anything; if you change a file in the source, but do not change its modification time (e.g. by resetting that after the change) or any other metadata such as size or ownership, then without --checksum rsync will be "fooled" into thinking it's the same as the version in the --link-dest tree, and will link to that. With --checksum rsync will see that it is in fact different, and will create a new file instead of linking. Paul Slootman
Apparently Analagous Threads
- --compare-dest apparently incompatible with --checksum or --size-only
- Skip based on checksum not worked as expected when using with complex filter rules.
- DO NOT REPLY [Bug 4128] New: ignore-times with link-dest behaves unexpected / sematics not clear
- [PATCH] Fix NAT for domU checksum offload
- Skip creating files in --backup-dir if content has not changed