# kudos to dzaku at consolechars.wordpress.com ### MOUNT qcow2 image with lvm partitions # ensure nbd can handle that many partitions sudo modprobe nbd max_part=8 # present image as block device through NBD sudo qemu-nbd --connect=/dev/nbd0 # check the disk partitions, see if LVM_member is there sudo fdisk /dev/nbd0 -l # some time partition devices are not created, use partx for that sudo partx -a /dev/nbd0 # list devices corresponding to partitions sudo ls /dev/nbd0* # refresh PhysVolume cache for this device sudo pvscan --cache /dev/nbd0p # find VolGroups sudo vgscan # find Volumes, check what is found and their status sudo lvscan # activate newly found VolGroups sudo vgchange -ay # mount the lvm partition to /mnt sudo mount /dev/mapper/ /mnt ### USE the mounted partition, e.g ls /mnt ### UNMOUNT # unmount LVM partition sudo umount /mnt # deactivate VolGroup sudo vgchange -an # disconnect image from NBD sudo qemu-nbd -d /dev/nbd0