rsync in-place (was Re: rsync 1tb+ each day)

Ben Escoto bescoto at stanford.edu
Thu Feb 6 05:52:45 EST 2003


On Wed, Feb 05, 2003 at 09:17:03AM -0800, Mike Rubel wrote:
> >   CB> Of course, a major issue with --inplace is that the file will be
> >   CB> in an intermediate state if rsync is killed mid-transfer.  Rsync
> >   CB> currently ensures that every file is either the original or new.
> > 
> > I'm curious, how does it ensure this?
> 
> During the copy, rsync writes to a temporary file in the same directory
> (the temp file is hidden; it starts with a ".").  Then, once the transfer
> is done, it mv's that temp file over the original.  My understanding is
> that mv is atomic under unix, so this action either happens in its
> entirety or not at all.

Even if mv is atomic, how does rsync make sure that the move doesn't
happen before the last of the data is written to the tempfile?  Does
it explicity fsync the tempfile, or is there some other way it knows?


-- 
Ben Escoto
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/rsync/attachments/20030205/c000a0c0/attachment.bin


More information about the rsync mailing list