1

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".

2 Answers 2

3

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

1
  • Block-Attach is meant to attach a disk to a DomU. Ok - Dom0 is a priviledged DomU - but this is too complicated - and you still would have to use kpartx -av /dev/xvda to use/mount the partitons on that disk.
    – Nils
    Apr 24, 2013 at 9:06
2

I'd use kpartx

Add disk mappings:

kpartx -a  /dev/vgvirt/virtguest-disk

See if you can find the vg.

vgscan

then vgchange and mount (for example under /mnt)

vgchange -a y yourVGname
mount /dev/yourVGname/yourLV /mnt

If you run LVM on the box from where you try to do this, and the names of the VG:s are the same, then you might get problems.

Here is a good howto: http://wiki.xen.org/wiki/Access_a_LVM-based_DomU_disk_outside_of_the_domU

or you could consider using guestfish.

2
  • But there is only LVM on the dom0, not the domU. But the Howto lead me on the right track. Thanks!
    – Exostor
    Apr 23, 2013 at 14:31
  • kpartx is enough. From the description there is no VG/LV on the DomU - so no need to do any extra tricks after kpartx.
    – Nils
    Apr 24, 2013 at 9:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .