Chance of equal checksum and changing blocks

Matt McCutchen matt at
Fri Jan 23 14:59:10 GMT 2009

David, please CC rsync at in your replies so that others
can help you and your messages are archived for others' future benefit.

On Fri, 2009-01-23 at 09:02 +0100, David de Lama wrote:
> >> - Finally I want two know if it is possible to change an amount of
> >> blocks manually? 
> >>   e.g. I made a 100 MB file with "dd if=/dev/zero of=/home/
> >> bs=1M count=100" and know I want to change, lets say, 10 blocks of
> >> this file. Is it possible?
> >I guess you're performing some kind of test of the delta-transfer
> >algorithm?
> >
> >The block size for each file defaults to approximately the square root
> >of its size.  You can find out the exact block size rsync is using for a
> >file by passing -vvv (--debug=deltasum2 in rsync 3.1.*) and looking for
> >"blength=" in the output, or you can specify a block size to use for all
> >files with the --block-size option.  Then, just overwrite the desired
> >areas of the file.

> My next question is, how to overwrite the desired areas in a file?

Here's an example.  Suppose the block size is 900 bytes (i.e., you
either specified --block-size=900 or saw blength=900 in the output).
Then you could use the following command to overwrite blocks 40 through
45 of the file (counting from 0) with zeros:

dd bs=900 if=/dev/zero of=/home/ seek=40 count=6

To overwrite with random data, change the if=/dev/zero to
if=/dev/urandom .


More information about the rsync mailing list