[Libguestfs] virt-rescue --ro option has no effect

Richard W.M. Jones rjones at redhat.com
Thu Sep 13 18:21:18 UTC 2012


On Thu, Sep 13, 2012 at 04:07:18PM +0200, Olaf Hering wrote:
> 
> Should 'virt-rescue -a some.img --ro' tell qemu/kvm that some.img is
> supposed to be read-only in the guest? I have not looked at the code
> yet, perhaps --ro has a meaning only when attaching to a live guest.
> I was expecting that all write access to some.img is denied in the
> rescue shell.

So firstly I certainly hope that virt-rescue --ro does something,
otherwise that would be a frighteningly serious bug.

However what it does is possibly not too obvious.  You can't have a
"read-only" disk in general (IDE simply doesn't support it).  Also
even where you are allowed one (eg. virtio-blk) you wouldn't want one.
No mount command, even 'mount -o ro', would work, because for most
filesystems the journal must be replayed even for read-only access.

What this option does instead is to place a writable snapshot on top
of the disk which allows you (or mount etc) to write to the disk.  The
modifications are discarded when the libguestfs handle is closed and
the underlying disk is untouched.  There is also a regression test for
this (tests/qemu/qemu-snapshot-isolation.sh).

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw




More information about the Libguestfs mailing list