mouting domU lvm in dom0

Requirement - to mount a LVM based Xen VBD file on dom0 for any reason (or for the heck of it):

kpartx -

apk add multipath-tools

installs kpartx.

kpartx -v -a /dev/mapper/lvmVolName

ls -l /dev/mapper/lvmVolNamePartition* <-- will show all partitions now ... as devices

mount /dev/mapper/lvmVolNamePartitionx <mount point>
kpartx -d /dev/mapper/lvmVolName
fdisk -l /dev/mapper/sataAB_data-xen_VG2_P_alpineServer
Disk /dev/mapper/sataAB_data-xen_VG2_P_alpineServer: 107.3 GB, 107374182400 bytes255 heads, 63 sectors/track, 13054 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/mapper/sataAB_data-xen_VG2_P_alpineServer1 * 1 13 102400 83 LinuxPartition 1 does not end on cylinder boundary/dev/mapper/sataAB_data-xen_VG2_P_alpineServer2 13 536 4194304 82 Linux swapPartition 2 does not end on cylinder boundary/dev/mapper/sataAB_data-xen_VG2_P_alpineServer3 536 13055 100559872 83 LinuxPartition 3 does not end on cylinder boundary
losetup /dev/loop0 /dev/mapper/sataAB_data-xen_VG2_P_alpineServer
partprobe /dev/loop0
dharra [~/Alpine_3.3.3_64]# ls -l /dev/loop0*
brw------- 1 root root 7, 0 Apr 12 11:54 /dev/loop0brw-rw---- 1 root root 259, 4 Apr 12 18:59 /dev/loop0p1brw-rw---- 1 root root 259, 5 Apr 12 18:59 /dev/loop0p2brw-rw---- 1 root root 259, 6 Apr 12 18:59 /dev/loop0p3

dharra [~/Alpine_3.3.3_64]#

the paritions loop0p1 etc can now be mounted..

mount /dev/loop0p3 /mnt

Once finished:

umount /mnt
losetup -d /dev/loop0

HOWEVER, this leaves the /dev/loop0p1 etc hanging out there ...these devices are not deleted. As suggested here:

http://superuser.com/questions/805735/how-to-delete-partition-device-from-loop-device

reboot will solve the problem.