== Mounting an image == we can mount an image with qemu-nbd after loading the nbd module into the kernel `modprobe nbd max_parts=8` `qemu-nbd -connect=/dev/nbd0 /path/to/qcow2image` `mount /dev/nbd0p5 /mnt` to unmount `umount /dev/nbd0p5` `qemu-nbd -d /dev/nbd0` == NetBSD == It is possible to mount and run a .luks encrypted drive since qemu supports it. This means migrating from any luks encrypted partions is easier than one would expect == Resizing == To resize an image, we have to resize both the backing file and the active overlay/snapshot file with `qemu resize file.qcow2 +nG` where `n` is the number in GB we want to extend the disk with. Then, inside the VM, we have to issue `parted /dev/sdX`, which will fix the GPT (if any). Then we issue `resizepart N +G` to resize the partition we want to extend. `N` represents the number in the table and `n` is the number of GB we want to extend by. After that, we exit parted. Then we issue `resize2fs /dev/sdXn` where `X` is the letter of the drive and `n` is the partition we whish to convert to the filesystem .