I'm making a minor change to a very large file image file (just a few pixels difference) which takes a long time to transfer over the network.
Is there a way for rsync to identify the difference in the file and only send the small diff over the network?
rsync
delta-transfer algorithm does this by default. Quoting rsync manpage:
DESCRIPTION
Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. It offers a large number of options that control every aspect of its behavior and permit very flexible specification of the set of files to be copied. It is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination. Rsync is widely used for backups and mirroring and as an improved copy command for everyday use.
If you want to disable it, you will have to use the -W
or --whole-file
option.
-W, --whole-file
This option disables rsync's delta-transfer algorithm, which causes all transferred files to be sent whole. 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.
If you really know how much your file have changed doing, you could even optimize this delta transfer behavior by tunning your delta block size:
-B, --block-size=BLOCKSIZE
This forces the block size used in rsync's delta-transfer algorithm to a fixed value. It is normally selected based on the size of each file being updated. See the technical report for details.
And if you want more information about the algorithm itself, you can find it here: The Rsync algorithm
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加