[Libguestfs] Virt-copy-in Doubt

Richard W.M. Jones rjones at redhat.com
Tue Jan 13 09:45:04 UTC 2015


On Tue, Jan 13, 2015 at 02:49:03PM +0530, Ramani Kothadia wrote:
[A question about virt-copy-in & disk corruption, not reproduced
because it was sent privately]

libguestfs modifies the disk image directly.  If the same disk image
is also being used by a running guest, then the guest kernel will not
realize that changes to filesystem metadata and data are being made
behind its back.  It might make conflicting changes, or cache copies
of old disk blocks that libguestfs has changed.

It's a bit like connecting two host machines to a single disk drive,
and then expecting them to be able to write to the same filesystem on
that drive.

This is not a theoretical problem either: if you try it you really
will get disk corruption.

There are filesystems that can cope with being used in a cluster
(eg. RHCS GFS), but common filesystems like ext4 certainly cannot be
used this way.

libguestfs can access live filesystems in a special read-only mode, in
which case libguestfs does not write to the filesystem so cannot
interfere with the guest.  This is still not completely error-free as
you may see unexpected/strange stuff on the libguestfs side.  But it
is safe, and in practice works fine.

Yes, the virtio-serial device is used to implement virt-copy-in.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list