[Libguestfs] Mounting disk images with ext2 filesystems on RHEL7

Richard W.M. Jones rjones at redhat.com
Mon Feb 16 23:10:55 UTC 2015


On Mon, Feb 16, 2015 at 06:00:06PM -0500, Leonard Basuino wrote:
> Hope someone can point me in the right direction.  I don't know if what I
> am trying to do should work or not.
> 
> I have 2 disk images.  One is a VM with an ext2 boot filesystem and ext4
> filesystems with the OS loaded.  I am amble to guestmount this with no
> issue and am able to see the files that are on the ext2 file system.
> 
> I can also run guestfish on the image, mount the ext2 filesystem, and list
> the files.
> 
> However, the second image I have is only a boot disk image with just an
> ext2 filesystem.
> 
> guestmount complains that there is no OS and won't mount.

What you really need to do is run:

  virt-filesystems -a second-disk.img --all --long -h

which will tell you what filesystems (etc) are available in the second
image.

> guestfish complains "...wrong fs type, bad option, bad superblock...".

Try using guestfish -v -x flags to provide extra information about
this error.  See:

http://libguestfs.org/guestfs-faq.1.html#debug

Also, what version of libguestfs and where did you get it from?

> Should I be able to mount a boot disk image with guestmount?

Yes, libguestfs aims to be able to access any disk image, and mostly
we have achieved that.  Whether it is bootable or not wouldn't
normally matter.

> I suspect I'll have to use the -m (mount) option and not -i (as I did for
> the image with an OS), but that failed too even though I passed in the fs
> type of ext2,

`-i' invokes inspection:

http://libguestfs.org/guestfs.3.html#inspection

Inspection is an optional convenience feature, and you can access disk
images without it, but then you need to know what filesystems you want
to mount (eg. using 'virt-filesystems' -- see above).

> Why would I be able to mount, via guestfish, the ext2 in the first image
> (with other filesystems of type ext4) but not the disk image with only an
> ext2 filesystem?

I've no idea, but for more information you can enable debugging at run
time:

http://libguestfs.org/guestfs-faq.1.html#debug

Rich.


-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list