Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I copied many files in many folders (~54GB) from an ext4 location to another with cp ~/1 ~/2 -d -r -v -i in bash. I then wanted to check that all files were copied correctly, so I ran rsync --delete -vturOn ~/1 ~/2, but rsync wanted to copy all the files. Why is this?

PS: I intended to use cp with -a, but used -d in error.

Edit: An answer here led me to use the --itemize-changes flag which shows me >f..t...... for all files. The man page indicates that the t means modification times are different, the type-files is a file (f) and the item attributes only are being modified (.). Is this correct? So all that will be changed are the modification times?

Edit: I ran the rsync (without the -n) and despite the t modification times being different, it proceeded to copy all the files again (the actual file content), which is unexpected because rsync should do a diff copy anyway, which should be noting?

Edit: Stopped the sync and reran without the -t parameter. Now the itemized changes showed 'T' instead of t. It seems that I will have to copy all the files via rsync at least once if I wish to use rsync on these files in the future.

Edit: I deleted the target files and copied everything again with rsync with -van parameters.

share|improve this question
add comment

1 Answer 1

From the rsync documentation:

Rsync finds files that need to be transferred using a "quick check" algorithm (by default) that looks for files that have changed in size or in last-modified time.

Also, when both the source and the target are local, rsync runs with the --whole-file option by default.

-W, --whole-file

With this option rsync’s delta-transfer algorithm is not used and the whole file is sent as-is instead. The transfer may be faster if this option is used when the bandwidth between the source and destination machines is higher than the bandwidth to disk (especially when the "disk" is actually a networked filesystem). This is the default when both the source and destination are specified as local paths, but only if no batch-writing option is in effect.

I'm not sure, but it sounds like you may want the --checksum option.

-c, --checksum              skip based on checksum, not mod-time & size

Note that this requires reading both the source and the target files from disk to compute the checksum.

More on this:

http://superuser.com/a/118984/219809

http://serverfault.com/a/279346

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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