(I started this as a draft two years ago, but wasn’t sure about its correctness then.)
Usually, one uses the -a switch when archiving files with rsync from Unix to Unix. -a is an abbreviation for -rlptgoD, which means
- -r: recurse into directories,
- -l: copy symlinks as symlinks,
- -p: preserve permissions,
- -t: preserve modification times,
- -g: preserve group (ownership),
- -o: preserve owner,
- -D: preserve device and special files,
but this doesn’t make sense if the target is an MS FAT device (such as a USB key) or a CIFS/SMB/Samba host, as that old file system cr4p doesn’t know anything about symbolic links, file permissions, ownerships or other Unixy properties. Thus, rsync fails to match these features at all and synchronizes every single bit of every single file again.
The solution I found is to simply use the tuple of time-stamp and file size as the only criteria whether something has changed. This still results in warnings about that the time-stamps of directories couldn’t be set, but at least the sync works. An example command line could thus be
$ rsync -rt $source $target
Tracked: Nov 04, 13:58