Take a look at kpartx
- it's especially useful for managing VMs where entire file systems are often packed into single volumes.
kpartx
can create device nodes for partitions nested on a block device or disk image.
Mount (one of the following):
kpartx -av your_vm_disk.img
kpartx -av /dev/mapper/your_device
Where your_device
could be an LVM partition. The -v
option causes kpartx
to display the devices it creates for nested partitions.
Mount the appropriate /dev/mapper/loopXpX:
mount /dev/mapper/loop0p1 /mnt
Unmount (after unmounting loop devices):
umount -d /dev/mapper/loop0
umount -d diskimage.img
Remove the device mappings:
kpartx -dv your_vm_disk.img
kpartx -dv /dev/mapper/your_device