Mount and Unmount QCOW2 images

Mount :- Install qemu-utils and enable ndb module [code lang=”bash”] sudo apt-get install qemu-utils sudo modprobe nbd [/code] Connect the image to the first nbd device [code lang=”bash”] sudo qemu-nbd -c /dev/nbd0 xyz.qcow2 [/code] Mount the image. For nbd0, see all the devices available (/dev/nbd0<some-number-or-string>) and try attaching to starting from the first one [code…


Mount :-

Install qemu-utils and enable ndb module

[code lang=”bash”]
sudo apt-get install qemu-utils
sudo modprobe nbd
[/code]

Connect the image to the first nbd device

[code lang=”bash”]
sudo qemu-nbd -c /dev/nbd0 xyz.qcow2
[/code]

Mount the image. For nbd0, see all the devices available (/dev/nbd0<some-number-or-string>) and try attaching to starting from the first one

[code lang=”bash”]
sudo mount /dev/nbd0p1 /mnt/qcow1
sudo mount /dev/nbd0p2 /mnt/qcow2…
[/code]

Unmount :-

Unmount it.

[code lang=”bash”]
sudo umount /mnt/qcow1
sudo umount /mnt/qcow2…
[/code]

Disconnect the loopback device too

[code lang=”bash”]
sudo qemu-nbd -d /dev/nbd0
[/code]

Done!


Leave a Reply

Discover more from Prabhu System Technology

Subscribe now to keep reading and get access to the full archive.

Continue reading