On 12 Oct 2000, Bennett Todd <[EMAIL PROTECTED]> wrote:
> 2000-10-12-15:05:55 Richard Crane:
> > What does rsync do when copying a file that may be modified while it is
> > being read?
> But if files are being modified while they are being read, rsync can
> get badly confused, at least in principle. Best to avoid stressing
> it.
Bennett's explanation is very good.
There's not much rsync can do beyond this, as neither Unix nor NT have
ACID-transactional filesystems, and so we can't ask the OS to give us
a consistent view of the file while we synchronize it.
However, you can do this yourself with a wrapper appropriate to the
situation. For example, you might copy the file to a temporary
directory before you rsync it, or temporarily suspend the program
writing to it. The common case of append-only logfiles should work
reasonably well: rsync will just copy more or less of it towards the
end.
> Now whether rsync can be actually provoked into e.g. dumping core,
> or erasing everything in sight, or siezing up your computer in a
> spasm that makes it catch fire and burn your machine room down, I
> don't know; it could be that all possible outcomes end up only
> corrupting the file that's modified during the sync.
Of course we're interested to hear of *any* situation which will
actually make it crash. (Preferably reproducible, and preferably on
Un*x.)
--
Martin Pool, Linuxcare, Inc.
+61 2 6262 8990
[EMAIL PROTECTED], http://www.linuxcare.com/
Linuxcare. Support for the revolution.
PGP signature