Lvm – mount a partition on an lvm partition

lvmmountxen

I have a xen dom0 server (named virtserver), which contains a guest machine, let's call it "virtguest".

The virtguest used to be a physical machine earlier, and the whole old disk (with several partitions) is located on a lvm volume on virtserver now (not made by me). How can I access (mount) sda1 on virtguest from virtserver?

Theoretically it should be located on /dev/vgvirt/virtguest-disk/sda1 but obviously that does not work.

Right now, virtguest gets the whole /dev/vgvirt/virtguest-disk as /dev/sda and then it mounts the partitions on that disk after boot as /dev/sda1, dev/sda2 etc, but now I need to extract information on sda1 from "outside".

Best Answer

So, what I have to do is run block-attach:

root@virtserver:# xm block-attach 0 phy:/dev/vgvirt/virtguest-disk xvda w
root@virtserver:# mount /dev/xvda1 /mnt

or use xl instead of xm if it is xen > 4.1