How do I mount a qcow2 disk image?
47,958
Solution 1
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
Solution 2
There's also libguestfs, but it's not yet available from official repositories1. There are binaries in libguestfs.org though.
Related videos on Youtube
Comments
-
RusGraf almost 2 years
I have a QEMU virtual machine that uses a qcow2 disk image.
How can I mount its filesystem without powering on the virtual machine?
-
RusGraf almost 14 yearsThe xmount manual states that only EWF and raw disk images can be used.
-
RusGraf almost 14 yearsLooks like
qemu-nbd
is the best way to go, as long as I remember tomodprobe nbd
first.qemu-nbd
fails silently if this module has not been loaded! -
Jonathon Reinhart over 7 yearsI wrote a little tool to wrap this up: github.com/JonathonReinhart/qcow2-explore
-
Twirrim over 6 yearsA qcow2 image is not a raw image, and can't be mounted through either of those approaches.
-
myrdd over 4 years
qemu-nbd
is part of theqemu-utils
package, so no need to install KVM -
ivo over 3 yearsI must appreciate this very nice, yet simple and powerful answer. It helped me to resolve my issue in a couple of minutes. Thank you Tim Yates.