Mounting disk images with ext2 filesystems on RHEL7
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. guestfish complains "...wrong fs type, bad option, bad superblock...". Should I be able to mount a boot disk image with guestmount? 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, 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? TIA! Lenny B.
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
On Mon, Feb 16, 2015 at 6:10 PM, Richard W.M. Jones <rjones@redhat.com> 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
On Mon, Feb 16, 2015 at 06:00:06PM -0500, Leonard Basuino wrote: 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.
The only filesystem is /dev/sda1 of type ext2
guestfish complains "...wrong fs type, bad option, bad superblock...".
Try using guestfish -v -x flags to provide extra information about this error. See:
I get the following debug info: mount -o /dev/sda1 / [ <time> ] EXT4-fs (sda1): mounting ext2 file system using the ext4 subsystem [ <time> ] EXT4-fs (sda1): bad geometry: block count 104388 exceeds size of device (103408 blocks) mount: wrong fs type, bad option, bad superblock on /dev/sda1 .... also, trying to mount the image with: mount -t ext2 <image> <mount point> returns: mount: wrong fs type, bad option, bad superblock on /dev/loop0 ... the end of dmesg has: [<time>] EXT4-fs (loop0): VFS: Can't find ext4 filesystem This has me wondering because the debug messages from guestfish -v -x indicate it is mouting ext2 with ext4. EXT4-fs (sdb): mounting ext2 filesystem using the ext4 subsystem So is the problem that there is no ext4 filesystem in the image and RHEL 7 is having issues with it?
Also, what version of libguestfs and where did you get it from?
version 1.22.6-22, came with RHEL 7
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
In data martedì 17 febbraio 2015 13:37:55, Leonard Basuino ha scritto:
On Mon, Feb 16, 2015 at 6:10 PM, Richard W.M. Jones <rjones@redhat.com> 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
On Mon, Feb 16, 2015 at 06:00:06PM -0500, Leonard Basuino wrote: 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.
The only filesystem is /dev/sda1 of type ext2
guestfish complains "...wrong fs type, bad option, bad superblock...".
Try using guestfish -v -x flags to provide extra information about this error. See:
I get the following debug info:
mount -o /dev/sda1 / [ <time> ] EXT4-fs (sda1): mounting ext2 file system using the ext4 subsystem [ <time> ] EXT4-fs (sda1): bad geometry: block count 104388 exceeds size of device (103408 blocks) mount: wrong fs type, bad option, bad superblock on /dev/sda1 ....
This might mean that the partition has been resized to a smaller size, but without updating the partition table. Is that the case? Can you please post the output of the guestfish command `sfdisk-l /dev/sda`?
also, trying to mount the image with: mount -t ext2 <image> <mount point> returns: mount: wrong fs type, bad option, bad superblock on /dev/loop0 ... the end of dmesg has: [<time>] EXT4-fs (loop0): VFS: Can't find ext4 filesystem
This has me wondering because the debug messages from guestfish -v -x indicate it is mouting ext2 with ext4. EXT4-fs (sdb): mounting ext2 filesystem using the ext4 subsystem
In recent (well, few years...) Linux versions the ext4 filesystems takes care of ext2 and ext3 versions as well, so the above message is correct.
So is the problem that there is no ext4 filesystem in the image and RHEL 7 is having issues with it?
I'm not sure what you mean here, can you please rephrase? Thanks, -- Pino Toscano
On Wed, Feb 18, 2015 at 4:51 AM, Pino Toscano <ptoscano@redhat.com> wrote:
In data martedì 17 febbraio 2015 13:37:55, Leonard Basuino ha scritto:
On Mon, Feb 16, 2015 at 6:10 PM, Richard W.M. Jones <rjones@redhat.com> 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
On Mon, Feb 16, 2015 at 06:00:06PM -0500, Leonard Basuino wrote: 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.
The only filesystem is /dev/sda1 of type ext2
guestfish complains "...wrong fs type, bad option, bad superblock...".
Try using guestfish -v -x flags to provide extra information about this error. See:
I get the following debug info:
mount -o /dev/sda1 / [ <time> ] EXT4-fs (sda1): mounting ext2 file system using the ext4 subsystem [ <time> ] EXT4-fs (sda1): bad geometry: block count 104388 exceeds size of device (103408 blocks) mount: wrong fs type, bad option, bad superblock on /dev/sda1 ....
This might mean that the partition has been resized to a smaller size, but without updating the partition table. Is that the case?
Can you please post the output of the guestfish command `sfdisk-l /dev/sda`?
(ok, I have to type it so pardon any typos) Disk /dev/sda: 101 cylinders, 64 heads, 32 sectors/track Units: cylinders of 1048576 bytes, blocks of 1024 bytes, counting from 0 Device Boot Start End #cyls #blocks Id System /dev/sda1 * 0+ 100 101- 103408 83 Linux /dev/sda2 0 - 0 0 0 Empty /dev/sda3 0 - 0 0 0 Empty /dev/sda3 0 - 0 0 0 Empty
also, trying to mount the image with: mount -t ext2 <image> <mount point> returns: mount: wrong fs type, bad option, bad superblock on /dev/loop0 ... the end of dmesg has: [<time>] EXT4-fs (loop0): VFS: Can't find ext4 filesystem
This has me wondering because the debug messages from guestfish -v -x indicate it is mouting ext2 with ext4. EXT4-fs (sdb): mounting ext2 filesystem using the ext4 subsystem
In recent (well, few years...) Linux versions the ext4 filesystems takes care of ext2 and ext3 versions as well, so the above message is correct.
So is the problem that there is no ext4 filesystem in the image and RHEL 7 is having issues with it?
I'm not sure what you mean here, can you please rephrase?
I was wondering if the message indicated it was looking for ext4 in the image which doesn't exist? I verified that the same image mounts without issue on a RHEL 6 box but not on a RHEL 7 box.
Thanks, -- Pino Toscano
_______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs
On Tue, Feb 17, 2015 at 01:37:55PM -0500, Leonard Basuino wrote:
I get the following debug info:
mount -o /dev/sda1 / [ <time> ] EXT4-fs (sda1): mounting ext2 file system using the ext4 subsystem [ <time> ] EXT4-fs (sda1): bad geometry: block count 104388 exceeds size of device (103408 blocks) mount: wrong fs type, bad option, bad superblock on /dev/sda1
It looks as if the image is properly corrupt. My suggestion is to try 'virt-rescue' on it.
This has me wondering because the debug messages from guestfish -v -x indicate it is mouting ext2 with ext4. EXT4-fs (sdb): mounting ext2 filesystem using the ext4 subsystem
This is just the way that RHEL 7 works. ie. CONFIG_EXT4_USE_FOR_EXT23=y is now always used. http://lwn.net/Articles/378913/ 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
On Wed, Feb 18, 2015 at 6:52 AM, Richard W.M. Jones <rjones@redhat.com> wrote:
On Tue, Feb 17, 2015 at 01:37:55PM -0500, Leonard Basuino wrote:
I get the following debug info:
mount -o /dev/sda1 / [ <time> ] EXT4-fs (sda1): mounting ext2 file system using the ext4 subsystem [ <time> ] EXT4-fs (sda1): bad geometry: block count 104388 exceeds size of device (103408 blocks) mount: wrong fs type, bad option, bad superblock on /dev/sda1
It looks as if the image is properly corrupt. My suggestion is to try 'virt-rescue' on it.
virt-rescue --suggest -a <image>
Inspecting the virtual machine or disk image ... This disk contains one or more filesystems, but we don't recognize any operating system. You can use these mount commands in virt-rescue (at the
<rescue> prompt) to mount these filesystems.
# /dev/sda1 has type 'ext2' mount /dev/sda1 /sysroot So I tried ...
<rescue> mount /dev/sda1 /sysroot [<time>] EXT4-fs (sda1): mounting ext2 filesystem using the ext4 subsystem [<time>] EXT4-fs (sda1): bad geometry: block count 104388 exceeds size of device (103408 blocks) mount: wrong fs type, bad option, bad superblock on /dev/sda1, missing codepage or helper program, or other error
In some cases useful info is found in syslog - try dmesg | tail I don't think the image is corrupt because a colleague is able to mount it with guestfish on a RHEL 6 box.
This has me wondering because the debug messages from guestfish -v -x indicate it is mouting ext2 with ext4. EXT4-fs (sdb): mounting ext2 filesystem using the ext4 subsystem
This is just the way that RHEL 7 works. ie. CONFIG_EXT4_USE_FOR_EXT23=y is now always used. http://lwn.net/Articles/378913/
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
On Wed, Feb 18, 2015 at 09:41:52AM -0500, Leonard Basuino wrote:
On Wed, Feb 18, 2015 at 6:52 AM, Richard W.M. Jones <rjones@redhat.com> wrote:
On Tue, Feb 17, 2015 at 01:37:55PM -0500, Leonard Basuino wrote:
I get the following debug info:
mount -o /dev/sda1 / [ <time> ] EXT4-fs (sda1): mounting ext2 file system using the ext4 subsystem [ <time> ] EXT4-fs (sda1): bad geometry: block count 104388 exceeds size of device (103408 blocks) mount: wrong fs type, bad option, bad superblock on /dev/sda1
It looks as if the image is properly corrupt. My suggestion is to try 'virt-rescue' on it.
virt-rescue --suggest -a <image>
Inspecting the virtual machine or disk image ...
This disk contains one or more filesystems, but we don't recognize any operating system. You can use these mount commands in virt-rescue (at the
<rescue> prompt) to mount these filesystems.
# /dev/sda1 has type 'ext2' mount /dev/sda1 /sysroot
So I tried ...
<rescue> mount /dev/sda1 /sysroot [<time>] EXT4-fs (sda1): mounting ext2 filesystem using the ext4 subsystem [<time>] EXT4-fs (sda1): bad geometry: block count 104388 exceeds size of device (103408 blocks) mount: wrong fs type, bad option, bad superblock on /dev/sda1, missing codepage or helper program, or other error
In some cases useful info is found in syslog - try dmesg | tail
I don't think the image is corrupt because a colleague is able to mount it with guestfish on a RHEL 6 box.
This is pretty strange, and may, I suppose, indicate a kernel bug of some kind. I imagine it's possible that (a) the ext4 driver doesn't understand some very obscure ext2 feature, and (b) since hardly anyone uses ext2, this bug has never been discovered before. Or it may be as Pino says that the filesystem is really truncated and ext4.ko is correctly moaning about that, but ext2.ko in RHEL 6 ignored it. Does running `e2fsck -n /dev/sda1' under virt-rescue show up any errors? Anything interesting in the output of `tune2fs -l /dev/sda1'? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
On Wed, Feb 18, 2015 at 9:47 AM, Richard W.M. Jones <rjones@redhat.com> wrote:
On Wed, Feb 18, 2015 at 6:52 AM, Richard W.M. Jones <rjones@redhat.com> wrote:
On Tue, Feb 17, 2015 at 01:37:55PM -0500, Leonard Basuino wrote:
I get the following debug info:
mount -o /dev/sda1 / [ <time> ] EXT4-fs (sda1): mounting ext2 file system using the ext4 subsystem [ <time> ] EXT4-fs (sda1): bad geometry: block count 104388 exceeds size of device (103408 blocks) mount: wrong fs type, bad option, bad superblock on /dev/sda1
It looks as if the image is properly corrupt. My suggestion is to try 'virt-rescue' on it.
virt-rescue --suggest -a <image>
Inspecting the virtual machine or disk image ...
This disk contains one or more filesystems, but we don't recognize any operating system. You can use these mount commands in virt-rescue (at
On Wed, Feb 18, 2015 at 09:41:52AM -0500, Leonard Basuino wrote: the
<rescue> prompt) to mount these filesystems.
# /dev/sda1 has type 'ext2' mount /dev/sda1 /sysroot
So I tried ...
<rescue> mount /dev/sda1 /sysroot [<time>] EXT4-fs (sda1): mounting ext2 filesystem using the ext4 subsystem [<time>] EXT4-fs (sda1): bad geometry: block count 104388 exceeds size of device (103408 blocks) mount: wrong fs type, bad option, bad superblock on /dev/sda1, missing codepage or helper program, or other error
In some cases useful info is found in syslog - try dmesg | tail
I don't think the image is corrupt because a colleague is able to mount it with guestfish on a RHEL 6 box.
This is pretty strange, and may, I suppose, indicate a kernel bug of some kind. I imagine it's possible that (a) the ext4 driver doesn't understand some very obscure ext2 feature, and (b) since hardly anyone uses ext2, this bug has never been discovered before. Or it may be as Pino says that the filesystem is really truncated and ext4.ko is correctly moaning about that, but ext2.ko in RHEL 6 ignored it.
Does running `e2fsck -n /dev/sda1' under virt-rescue show up any errors?
<rescue> e2fsck -n /dev/sda1 e2fsck 1.42.9 (28-Dec-2013) The filesystem size (according to the superblock) is 104388 blocks The physical size of the device is 103408 blocks Either the superblock or the partition table is likely to be corrupt! Abort? no
/boot contains a file system with errors, check forced. Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /boot: 36/26104 files (2.8% non contiguous), 12201/104388 blocks
Anything interesting in the output of `tune2fs -l /dev/sda1'?
I'm not retyping all of the output ... interesting? Filesystem state: not clean Block count: 104388
Rich.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
On Wed, Feb 18, 2015 at 10:07:20AM -0500, Leonard Basuino wrote:
<rescue> e2fsck -n /dev/sda1 e2fsck 1.42.9 (28-Dec-2013) The filesystem size (according to the superblock) is 104388 blocks The physical size of the device is 103408 blocks Either the superblock or the partition table is likely to be corrupt! Abort? no
/boot contains a file system with errors, check forced. Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /boot: 36/26104 files (2.8% non contiguous), 12201/104388 blocks
I would say this is (fairly) conclusive proof that the filesystem is really truncated, and RHEL 6 is just ignoring that hard fact. Note that the code paths used by ext4 kernel and e2fsck (ie. e2fsprogs) are quite different, and both think the filesystem is longer than the containing device. Sorry :-( 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
On Wed, Feb 18, 2015 at 10:07:20AM -0500, Leonard Basuino wrote:
<rescue> e2fsck -n /dev/sda1 e2fsck 1.42.9 (28-Dec-2013) The filesystem size (according to the superblock) is 104388 blocks The physical size of the device is 103408 blocks Either the superblock or the partition table is likely to be corrupt! Abort? no
/boot contains a file system with errors, check forced. Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /boot: 36/26104 files (2.8% non contiguous), 12201/104388 blocks
I would say this is (fairly) conclusive proof that the filesystem is really truncated, and RHEL 6 is just ignoring that hard fact. Note that the code paths used by ext4 kernel and e2fsck (ie. e2fsprogs) are quite different, and both think the filesystem is longer than the containing device.
Sorry :-(
No need to be sorry ... you have put me on a promising path ... I was able to mount it after resizing the filesystem ... within virt-rescue ... <rescue> resize2fs -f /dev/sda1
On Wed, Feb 18, 2015 at 10:18 AM, Richard W.M. Jones <rjones@redhat.com> wrote: then I was able to mount it with ... guestmount -a <image> -m /dev/sda1 <mount point> Not ideal for my needs, but work in progress.
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
participants (3)
-
Leonard Basuino -
Pino Toscano -
Richard W.M. Jones