How do I mount a qcow2 disk image?
I have a QEMU virtual machine that uses a qcow2 disk image.
How can I mount its filesystem without powering on the virtual machine?
4 Answers
A quick google search turns up the qemu-nbd program, mentioned here. It is part of the qemu-kvm package, so you'll have to install KVM if you aren't using that already. Not sure about any direct GNOME/KDE solutions, if that is what you were looking for. Here is an example for using it:
sudo modprobe nbd
sudo qemu-nbd -c /dev/nbd0 --read-only /path/to/image.qcow2
udisksctl mount -b /dev/nbd0p1 5 There's also libguestfs, but it's not yet available from official repositories1. There are binaries in libguestfs.org though.
1xmount can make the disk images of some VMs look like a raw disk (which can then be partitioned with losetup, and the partitions mounted). I don't know if it supports qcow2, however.
you can directly mount as a normal mount like this
mount /dev/sdb1 /mount-pointBut if u have n number of device mean you want again mount it to another directory for that you can follow this one:
Mounting a partition from raw image is pretty simple:
losetup /dev/loop0 image.img
kpartx -a /dev/loop0
mount /dev/mapper/loop0p1 /mnt/image 1 More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"