0

I want to install Ubuntu (or any distro) as UEFI with QEMU/libvirt and make some changes there at runtime and shut down the machine. This will create a qcow2 disk.

If this was not a virtual machine and in the previous step I installed Ubuntu on a real PC instead, I could use a live USB to get access to the hard disk of the PC and do a byte copy of the entire disk. This would leave me with a raw image I could mount on a loopback device or pass it to tools which expect a raw image.

Is there are way to access that kind of raw image directly from qcow2 somehow?

TheMeaningfulEngineer
  • 5,735
  • 15
  • 64
  • 113

1 Answers1

0

To mount an qcow2 image you can do ...

modprobe nbd max_part=16
qemu-nbd -c /dev/nbd0 image.qcow2
mount /dev/nbd0p4 /mnt

and vice versa ...

umount /mnt
qemu-nbd -d /dev/nbd0
Mario
  • 186
  • 4