Here’s a streamlined guide on how to mount a qcow2 disk image on your host server/system, which can come in handy for tasks like resetting passwords, editing files, or recovering data without needing to run the virtual machine.
Step 1 - Activating NBD on the Host
In your terminal, run the following command to enable NBD (Network Block Device) on your host (with sudo if required):
|
|
Step 2 - Link the QCOW2 to Network Block Device
Next, connect the QCOW2 disk image to the network block device using the following command:
|
|
Step 3 - Identify the Virtual Machine Partitions
You can find the partitions of the virtual machine by running the following command:
|
|
Step 4 - Access the Virtual Machine Partition
Now, to mount the partition from the virtual machine, you can use the following command:
|
|
Step 5 - Wrapping Up: Unmount and Disconnect
Once you’ve finished with the tasks, it’s crucial to unmount and disconnect appropriately. Use the following commands to do so:
|
|
This will effectively close off your session.