rsync doesn’t sync files

1

I'm using rsync(with Cygwin) to sync 2 local folders. The folders contains binary files.

I'm using the following command:

rsync.exe -av dir1/ dir2/

but the files in dir2 are only partially updated, there are few different files.

Does anybody know of a problem with rsync on Windows? Should I use some other flags?

modi

Posted 2010-05-10T08:37:32.007

Reputation: 125

Thanks mate it looks promising <br> Does it use the rsync Algorithm or something like it to save bandwidth – modi – 2010-05-10T08:54:31.070

i think i remember that the "rsync algorithm" (where it compares-and-only-copies-differences) only works on remote transfers -- ie, using "dir1/ dir2/" won't use the difference detection, it'll just copy files that don't already exist in the destination directory. you might use -W to make sure (that's capital W, or --whole-file, for copy-whole-files). i'll let an rsync expert chime in with some real knowledge; i don't recall the limitation that well. you might be getting bitten by a cygwin-specific behavior. – quack quixote – 2010-05-10T09:59:31.330

Answers

3

This is a guess: It might be that the time resolution is not large enough and the files are different while their timestamps fall into the same second and have the same length, so rsync can't distinguish them and skips them, thinking they are the same. The option --ignore-times might help in this case, as that will force rsync to check the file content, not just file size and timestamp.

Another alternative to --ignore-times is --checksum, which will force rsync to checksum each file and should guarantee you that the directories are exactly equal afterwards, it will however slow things down a bit, especially on large file hierarchies.

Another more mundane issue could simply be failing hardware, RAM, harddrive or whatever that leads to files being copied incorrectly, I have seen that happen quite a few times. To check for that use a memory checker like memtest86+ and do repeated copies of the same directory structure to a different target directory and compare the results, if the results are different each time, something is fishy.

Grumbel

Posted 2010-05-10T08:37:32.007

Reputation: 3 100

use --checksum. – mpez0 – 2010-05-10T12:18:40.933

0

Rsync is powerful and clever but you do need to understand exactly what you are asking it to do which means reading the whole manual three times. Your use of it looks simple but so do lots of things that aren't.

And yes, --whole-file is the default for local-local rsync.

Denis howe

Posted 2010-05-10T08:37:32.007

Reputation: 1