Categories
Ubuntu Virtualisation

Rescue Partitions in LVM

Using hypervisors is great. However, you will end up in whole “disks” with partitions in an LVM logical volume. And “from the outside” (e.g. when you are trying to rescue data on that damn disk) is not that easy.

pvscan will give you the lvs. But there inside is nothing you can mount directly.

Solution: kpartx

kpartx -av /dev/mapper/yourvg–yourlv

add map yourvg–yourlvp1 (253:26): 0 2048 linear 253:21 2048
add map yourvg–yourlvp2 (253:27): 0 67102720 linear 253:21 4096

This will read the partition table of the lv and add additional endpoints to the /dev/mapper to mount them.

mount -oro /dev/mapper/yourvg–yourlvp1 /mnt

Source: http://www.microhowto.info/howto/mount_a_partition_located_inside_a_file_or_logical_volume.html