I want to move some files using rsync, but it's vital that the files are intact at the destination before removing the source files. The thing is, I can't find any information telling me how rsync decides that a file has been transferred correctly: I'll need it to be properly checksummed. Anyone know how rsync does it?

  • I am pretty confident that if it can't pass any attributes for instance, it won't accept the file as being copied. succesfully But why don't you give it a try by killing the session mid-copy? After all the algorithm might be the same but the implementations differ. – user Dec 20 '11 at 14:24
  • In answer to "how safe is it": how good is your disaster recovery plan? – Andrew Dec 21 '11 at 4:22
  • Rock solid on one side of the sync, non-existant at the other. And unfortunately I don't have control over that side :-( Hence the reason I'd like to make any failures as unlikely as possible. – spookypeanut Dec 21 '11 at 11:29

You need to pass the --checksum to ensure files that have the same size & times on source and destination are not skipped. Then, as per Wikipedia:

The recipient splits its copy of the file into fixed-size non-overlapping chunks and computes two checksums for each chunk: the MD4 hash, and a weaker 'rolling checksum'. (Version 30 of the protocol, released with rsync version 3.0.0, now uses MD5 hashes rather than MD4.[14]) It sends these checksums to the sender.


The section about --checksum in the manpage says rsync always verifies the ckecksum of the received file to consider it complete (even when --checksum is not used):

Note that rsync always verifies that each transferred file was correctly reconstructed on the receiving side by checking a whole-file checksum that is generated as the file is transferred, but that automatic after-the-transfer verification has nothing to do with this option's before-the-transfer "Does this file need to be updated?" check.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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