0
How to Mount and Browse a LVM qcow2 Image
This guide will show you how to mount a qcow2 image and also browse the qcow2 image if it is an LVM partition
- You need to add the nbd module to your machine
modprobe nbd max_part=63
- You then need to mount the qcow2 image to the NDB device driver
qemu-nbd -c /dev/nbd0 /path/to/image.qcow2
- You can now check for the partitions by using the following command
fdisk -l /dev/nbd0 and you should get a list like the one belowDisk /dev/nbd0: 34.4 GB, 34359738368 bytes 255 heads, 63 sectors/track, 4177 cylinders, total 67108864 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000064e8 Device Boot Start End Blocks Id System /dev/nbd0p1 * 2048 499711 248832 83 Linux /dev/nbd0p2 501758 67106815 33302529 5 Extended /dev/nbd0p5 501760 67106815 33302528 8e Linux LVM
- You next need to let the computer scan for the LVM volumn by using vgscan and you should get something similar to this following output below:
Reading all physical volumes. This may take a while... Found volume group "Multicraft-vg" using metadata type lvm2 Found volume group "pve" using metadata type lvm2
- Once scanned, you will then need to add the LVM to your computer and set as Active, this can be done by using vgchange -ay and you should get the similiar output as below:
2 logical volume(s) in volume group "Multicraft-vg" now active 4 logical volume(s) in volume group "pve" now active
- Now the LVM is found, only thing left to do is mount the LVM to a folder
- First make a folder mkdir /mnt/image
- Next mount the LVM by doing something like this:
mount /dev/VolGroupName/LogVolName /mnt/image
- and you should be able to go to /mnt/image and your files will be there!
- Once you have finished with the files, you need to unmount the folder:
umount /mnt/image
- Also dont forget to make the LVM inactive:
vgchange -an VolGroupName
- And finally detach the image from the computer all together:
qemu-nbd -d /dev/nbd0