2

I have built a VG named cinder-volumes. Within this VG, I created a PV named leader-volume. Then I mounted this PV as the root filesystem of a KVM Ubuntu installation. During the installation process, I selected LVM partition. At last, I created a snapshot for the PV leader-volume. Now I want to read some files within my Ubuntu installation... What shall I do?

1 Answer 1

10

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.