Programster's Blog

Tutorials focusing on Linux, programming, and open-source

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.


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 \

The -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.


Last updated: 18th June 2021
First published: 16th August 2018