Ubuntu - Mount Qcow2 Image
Sometimes things go wrong and you need to access the files stored on your qcow2 disk images from the host directly, rather than through the VM that uses it (such as in cases where the VM doesn't boot).
This tutorial will show you how to mount your qcow2 disk images to a local folder on Ubuntu 16.04.
Steps
Install necessary packages (around 50MB for me)
sudo apt install libguestfs-tools -y
Now mount the disk image:
sudo guestmount -a \
/path/to/qcow2/disk/image.qcow2 \
-m /dev/sda \
/path/to/folder/to/mount/to
-m /dev/sda
specifies the partition within the qcow2 disk image that you wish to mount. You may need to change this to /dev/sda1
or /dev/sdb
etc. Don't worry if you dont know this, run the command and if it fails, you will be given some helpful alternative suggestions.
References
First published: 16th August 2018