Rsync write behaviour / efficiency

andy at andy at
Mon Mar 7 16:39:45 GMT 2005

Paul Slootman wrote:

> Inserting bytes at the beginning of a file can't be done, at
> least not on unix-like systems. That can only be done by copying
> the file.

Ok.  What about if there were some inserts in the middle
of the hypothetical 500MB file, starting for example at
the 450 millionth up to the 460 millionth byte (so
it's now 510MB).

Does rsync:

a) create a new file
b) have the ability to insert the bytes into the middle
   of the backup file
c) copy every byte from the 450th MB to the end of the
   original file (510thMB) into a temp file, truncate the
   destination file from the 450th MB onwards and then
   append the contents of the temp file there.
d) do something other than the above

Finally, what about the case where changes only appear
at the end of the file?  Is rsync smart enough to just
append to the destination file?

More information about the rsync mailing list