3

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.

2
  • Did you find the right options for cp such that rsync will not copy again?
    – haridsv
    May 13, 2015 at 5:03
  • No... I didn't experiment further.
    – SabreWolfy
    May 13, 2015 at 6:39

1 Answer 1

3

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:

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

https://serverfault.com/a/279346

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .