Mounting qcow2 Images

If you previously converted a raw image using qemu-img convert to a qcow2 image you maybe want to mount it to retrieve and modify data:

1modprobe nbd max_part=8
2qemu-nbd --connect=/dev/nbd0 db1_old.qcow2

Now you can mount partitions in the image using:

1mount /dev/nbd0p1 /mnt/

In order to unmount and remove the device:

1umount /mnt/
2qemu-nbd --disconnect /dev/nbd0

You can also unload the kernel module: modprobe -r nbd

Do you have questions? Send an email to max@maxammann.org