0

rsync is said to use delta-transfer algorithm to transfer files.

For a preexisting destination file with the same filename as a source file,

  1. Is the delta-transfer algorithm used

    • only after rsync have decided to transfer the source file to the destination, or
    • during determining whether or not rsync will transfer the source file to the destination?
  2. When rsync has decided to transfer the source file to the destination file,

    Does the delta-transfer algorithm transfer the difference between the source and destination files?

    Does the delta-transfer algorithm work at the "sub-file" level, by first calculating the patch file between the two files, and then transferring the patch file to the destination, and then applying the patch file to the preexisting destination file to get an identical copy of the source file?

    If so, do rsync need to transfer the source file to the destination in order to calculate the patch file between the source and destination files? If yes, doesn't that contradict the purpose of the delta-transfer algorithm to avoid transferring the whole source file?

Thanks.

4

only after rsync have decided to transfer the source file to the destination

Yes.

during determining whether or not rsync will transfer the source file to the destination

No. Once rsync starts the delta algorithm, it is fully committed to updating the file.

Does the delta-transfer algorithm transfer the difference between the source and destination files?

By default, yes. You can disable it with the --whole-file option. Note that what is sent by the delta-transfer algorithm is not literally a diff of the two files.

Does the delta-transfer algorithm work at the "sub-file" level, by first calculating the patch file between the two files, and then transferring the patch file to the destination, and then applying the patch file to the preexisting destination file to get an identical copy of the source file?

No, because rsync does not assume that the sender has a copy of the destination's version of the file.

rsync uses rolling checksums to determine matching portions of the file without transferring the whole file in either direction. Of course, if there are no matches, the whole file will need to be sent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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