Mounting KVM image

Richard W.M. Jones rjones at
Tue Jun 15 07:50:37 UTC 2010

On Tue, Jun 15, 2010 at 12:57:23AM -0400, Alex wrote:
> Hi,
> > Take it a step at a time:
> >
> >  guestfish -a systmp-img.img --ro
> >  ><fs> list-devices
> >  ><fs> list-partitions
> >  ><fs> lvs
> >
> > You can then mount the partition(s) that contain data you want to
> > read, for example:
> >
> >  ><fs> mount /dev/vda1 /
> For me, this produced:
> ><fs> mount /dev/vda1 /
> libguestfs: error: mount: /dev/vda1 on /: mount: /dev/vda1 already
> mounted or /sysroot/ busy
> mount: according to mtab, /dev/vda5 is already mounted on /sysroot

Can you show me the complete output.  It looks like you mounted
/dev/vda5 first, or you used the '-i' argument to guestfish which
mounts up partitions for you already.  Use the guestfish commands
'mounts' or 'mountpoints' to see what is mounted already:

> Is it referring to the host mtab or the guest one?

Neither ... see below.

> I thought this was the whole point of the "mount" commands you
> referenced above? If not, what is the difference? Where else would it
> mount it, virtually, within guestfish only?

Yes, virtually and internally to libguestfs.  However if you use
guestmount, then they are mounted on the host.  For advanced users
only, the architecture is explained here, but as a beginner I wouldn't
worry too much about this:

> The docs say clearly not to use guestmount to mount partitions on a
> live system.

You can use the --ro option which makes this safe, although as the
name implies this won't let you write to them.

> What program can be used for this purpose, such as to
> perform a backup while the guest is actually running?

There can be no such thing.  This is simply not possible with ordinary
guest filesystems, eg. ext3 or NTFS.  The only way you could possibly
do this would be to use a cluster-aware filesystem such as Red Hat's
GFS, or use a network share (NFS, CIFS etc).

What would happen if you took a physical SCSI drive and wired it up to
two machines, then tried to use an ext3 filesystem in write mode from
both machines?  You'd get catastrophic disk errors in a very short
time.  It's the same in the virtual case.

> I've managed to successfully mount the image using a simple guestmount
> command. Is there an option for it to be more verbose while it's
> starting, to have it print out information on what it's doing while
> booting, particularly for non-kvm-capable systems?

export LIBGUESTFS_DEBUG=1  See also:

There are also some trace options specific to guestmount which are
covered in the manpage.


Richard Jones, Virtualization Group, Red Hat
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.

More information about the users mailing list