Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using rsync to copy a directory from host A to host B. After the rsync is completed successfully, I check the files with the directory and find that some files' md5sum is different but the timestamp is the same. Can anyone tell me why?

**rsync info:**
rsync  version 2.6.3  protocol version 28
Copyright (C) 1996-2004 by Andrew Tridgell and others
<http://rsync.samba.org/>
Capabilities: 64-bit files, socketpairs, hard links, symlinks, batchfiles, 
              inplace, IPv6, 64-bit system inums, 64-bit internal inums

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.

**rsync option**
rsync -avP DIR HOSTB:foo/

After I found out this difference, I used the Linux touch command to update all the files within this directory and find out that rsync still syncs the files which have the same MD5 value.

This problem has bothered me for quite a long time; any help or suggestions?

share|improve this question
1  
rsync doesn't use md5 to test for differences, it uses timestamps and size. If the source and destinations were the same size and the modification dates were older or the same than the destination, then they wouldn't copy. Would that account for it? –  Paul Oct 20 '11 at 2:42

1 Answer 1

If you want rsync to detect changed files by checksumming, you have to use the -c/--checksum option. If this option is not set, rsync just compares file size and time of last modification.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.