1

Apart from one Virtual Host still running Xen/RHEL5, all our virtual capability is hosted on KVM hosts with LVM storage devices. I've stupidly attempted an Ubuntu full release upgrade on a guest running on the Xen machine, only to have it install a non-Xen kernel and refuse to boot (rookie error there).

Getting to the actual issue, the machine in question uses a single file based storage device. It's been a while since I've had to open one of these, but the process shouldn't be much different from opening an LVM volume, but for some reason I'm not seeing a partition table in device file.

root@vh1 web2.entrant # losetup -a
/dev/loop2: [0902]:34603012 (storage.img)
/dev/loop3: [0902]:32768005 (/srv/xen/domains/web2.entrant/disk.img)
root@vh1 web2.entrant # fdisk -l /dev/loop3

Disk /dev/loop3: 68.7 GB, 68719476736 bytes
255 heads, 63 sectors/track, 8354 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/loop3 doesn't contain a valid partition table

Inspecting another machine's partition file on the same host yields the same issue (no valid partition table), though it still starts/runs fine which is strange in itself.

Edit: (Adding kpartx)

root@vh1 ~ # kpartx -av /srv/xen/domains/web2.entrant/disk.img
root@vh1 ~ # 

No message (as expected) stating which partitions had been added

Edit: (Trying guestfish, virt-rescue, etc)

[root@vh1 web2.entrant]# virt-rescue --rw --suggest -a /srv/web2.entrant/disk.img 
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/vda has type 'unknown'

and with guestfish:

><fs> add-ro disk.img
><fs> run
><fs> list-filesystems
/dev/vda: unknown
><fs> lvs
><fs> 

I'm assuming I've messed up the partition table completely, unfortunately I haven't got a copy of what the machines partition layout looked like (seeing as the other guest it was copied from (whilst booted) seems to exhibit the same empty partition table when attempting the same process)

kwiksand
  • 463
  • 1
  • 8
  • 16

3 Answers3

0

Did you try using kpartx tool?

Use something like: kpartx -av path_to_disk_image. It will create loop entries so that you can then mount your partitions wherever you want. Might look like: mount mount_point_path /dev/mapper/loopXpX.

Heis Spiter
  • 598
  • 7
  • 17
  • Whoops! I meant to add that to the bottom of the question, I'd tried this too, as I use this all the time when mounting partitions inside LVM volumes (Edited above) – kwiksand Dec 31 '12 at 13:35
0

guestfish will be of use here.

I have used guestfish in the past to perform some lvm modifications

This document covers modifying individual files such as grub.conf, fstab etc by mounting lvm vgs.

Assuming the previous kernel is still available perhaps an avenue of recovery is to edit your grub.conf on the guest to boot into the older XEN kernel, and interactively make reparations once started.

Oneiroi
  • 2,008
  • 1
  • 15
  • 28
0

Have you tried simply mounting the disk image itself, sans partition table? i.e. mount -o loop /path/to/disk.img /mnt/testing

I seem to remember a guest can be a raw partition.

If you have the vm.cfg file that would be helpful as well.

Steve R.
  • 134
  • 1
  • 7