rsync icon indicating copy to clipboard operation
rsync copied to clipboard

How to verify transmitted data

Open xjie0626 opened this issue 1 year ago • 3 comments

I have already passed some data from server A to server B through the rsync command. Do I have any commands to verify the data from both servers and determine if they are correct?

xjie0626 avatar Nov 20 '24 02:11 xjie0626

To check if the transmition is correct.

  • Use tools such as md5sum or sha256sum) compare the checksums of source and destination directory
  1. find /path/to/source -type f -exec md5sum {} + > source_checksums.md5
  2. find /path/to/destination -type f -exec md5sum {} + > destination_checksums.md5
  3. diff source_checksums.md5 destination_checksums.md5
  • It should be correct if there is no output.

Or compare the directories' structure by diff -rq source/ destination/.

lighterCoder avatar Dec 31 '24 07:12 lighterCoder

thanks

xjie0626 avatar Jan 09 '25 08:01 xjie0626

Also you could just re-run your rsync command (with -c switch if you want total verification).

Of course if anything is transferred on the 2nd run, you need to do a 3rd, ... n-th run until there is nothing transferred :P

It would actually be good though if rsync added a switch allowing to re-use the checksums it sends for verifying transfers, to also verify the files written.

headbank avatar Jan 11 '25 11:01 headbank