Rsync copies more than the changes

Ole Tange ole at tange.dk
Sun Oct 6 14:03:39 MDT 2013


I use rsync on an SSD which is slow at writing, but very fast at
reading, so it is important to me to avoid writing data.

I had hoped rsync would only write changes in files when using
--inplace, but it seems not:

# Make a 1 GB file
$ perl -e 'print "x"x1000000000' > 1g
# rsync it (as expected this costs 1 GB writes)
$ ./rsync-3.1.0/rsync --progress --inplace -cva 1g 1g.copy
# Change the first 200 bytes inplace
$ perl -e 'open(A,"+<",shift) || die; seek(A,1,1); print A "a\n"x100;' 1g.copy
# rsync again
$ ./rsync-3.1.0/rsync --progress --inplace -cva 1g 1g.copy

I would have expected the final rsync to take 2 GB reads and 1 KB
write, but it seems to take 2 GB read and 1 GB write (measured by
/sys/block/sda/stat).

Had it taken 2 GB reads and 1 KB writes it would have been much faster
on my machine, as the 2 GB would be in the read cache.

How can I tell rsync to write less given the situation above?


/Ole


More information about the rsync mailing list