Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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)

share|improve this question
    
And what is the output from file /srv/xen/domains/web2.entrant/disk.img –  Michael Hampton Dec 31 '12 at 16:14
    
[root@vh1 ~]# file /srv/web2.entrant/disk.img /srv/web2.entrant/disk.img: data –  kwiksand Jan 1 '13 at 11:06
    
I think it would be easier and faster to restore from backup at this point. –  Michael Hampton Jan 1 '13 at 13:23

3 Answers 3

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.

share|improve this answer
    
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

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.