This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.
Step 1 - Enable NBD on the Host
modprobe nbd max_part=8
| #!/usr/bin/env bash | |
| shopt -s nullglob | |
| lastgroup="" | |
| for g in `find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V`; do | |
| for d in $g/devices/*; do | |
| if [ "${g##*/}" != "$lastgroup" ]; then | |
| echo -en "Group ${g##*/}:\t" | |
| else | |
| echo -en "\t\t" |