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?
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.) 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.