Working directly with qcow2 images without the need to boot a virtual machine can come in handy from time to time. These files represent virtual storage but unlike a raw byte image you cannot just use losetup. Luckily qemu comes with tools to make this task simple.
First verify that NBD is installed and your qemu installation has been compiled with NBD support.
Getting started, as root:
When everything is finished and the file systems unmounted:
Don’t forget the ever useful