When using rsync sometimes the rsync doesn't copy all the files done, below is my code I use. Is they a way to do a checksum or check after the rsync to see if all the files have been copied and if not try again until all files have been copied?
TEMP="/home/user/temp"
OPTS="-rav -h"
rsync $OPTS --stats [email protected]:/home/user/Local $TEMP
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 ...
The rsync tool can recursively navigate a directory structure and update a second location with any new/changed/removed files. It checks to see if files exist in the destination before sending them, saving bandwidth and time for everything it skips.
Method 1: Using –progress option to see the rsync progress:Use the “–progress” in the rsync command and “-av” to get a summary at the end of file transfer, consisting of transfer rate, sent/receive bytes, speed of transfer, and total file size.
By default, rsync determines which files differ between the sending and receiving systems by checking the modification time and size of each file. If time or size is different between the systems, it transfers the file from the sending to the receiving system.
As hinted at by uʍop ǝpısdn's answer, rsync -c
or rsync --checksum
may do what you need.
-c, --checksum: skip based on checksum, not mod-time & size
This forces the sender to checksum every regular file using a 128-bit MD4 checksum. It does this during the initial file-system scan as it builds the list of all available files. The receiver then checksums its version of each file (if it exists and it has the same size as its sender-side counterpart) in order to decide which files need to be updated: files with either a changed size or a changed checksum are selected for transfer. Since this whole-file checksumming of all files on both sides of the connection occurs in addition to the automatic checksum verifications that occur during a file's transfer, this option can be quite slow.
Note that rsync always verifies that each transferred file was correctly reconstructed on the receiving side by checking its whole-file checksum, 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.
The concerns about this being slow are probably not relevant these days, and this seems to be a good option when you can't or don't want to rely on modification times.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With