Tuesday, September 02, 2008

Mounting A Xen LVM Image

How to access a VM's logical volumes from Dom0. This assumes the VM is powered off and its image resides on an LVM (LVM's inside an LVM). It will not access /boot or the MBR.
Attach and confirm the image
# kpartx -a /dev/volume/domain
# kpartx -l /dev/volume/domain
Acquire and access the logical volumes
# vgscan
# lvdisplay | grep -i "Name\|Status"
# vgchange -ay
# lvdisplay | grep -i "Name\|Status"
Mount and view the volumes
# mount /dev/VolGroup00/LogVol00 /mnt
# cd /mnt
# ls -l
# cat /mnt/etc/hosts
# df
Umount, inactivate, and detach the volumes
# cd
# umount /mnt
# vgchange -an
# kpartx -d /dev/volume/domain
The single biggest "gottcha" is the need to ensure that Dom0 and the DomU's don't use the default volume group name.

No comments:

Post a Comment