Why is rsync taking a long time on large files that already exist

rsync

I made a backup of one of my computer's internal drives to an external. The next time I used rsync to sync the two drives, I noticed that large (40 + GB) files that weren't modified were still taking a long time to "copy". I thought rsync looked at mod-times and file size first? Why would it take so long; as though it were using checksum?

I had originally copied the files using rsync -rv --delete /src/path/ /dest/path/

Best Answer

Since you are not copying the metadata (which you would do if you used --archive or -a instead of just -r), the metadata (timestamps, ownerships etc.) will be different between the copy and the original. When you run rsync again, since the timestamps are different, the file is copied again.

So, you would instead want to use

rsync -ai --delete /src/path/ /dest/path

I'm using -i (--itemize-changes) since it also tells me why a file was copied.

Also note that when you do a local copy with rsync, it will not use its delta algorithm, but will instead behave as if --whole-file (or -W) was specified. This is because the delta algorithm is assumed to only be faster than a whole file transfer when transferring over a network. When using the delta algorithm, the whole file would need to be read and checksummed on both the source and target systems. Doing this locally seems a bit wasteful, so the file is just copied in full instead.

Related Question