QEMU-KVM Mount Raw Image
Jul 16, 2015
-
Shut down the VM using the file
-
Mount the image to a loop device using kpartx
kpartx -av /path/to/img/file
-
It should give you a list of the partitions. They will be created in the
/dev/mapper
directory with the names loop0p1, loop0p2, loop0p3, etc. for every partition in the image. -
Mount the partition
mount /dev/mapper/loop0p1 /mnt
-
Make the necessary changes
-
Unmount
umount /mnt
-
Delete the loop device
kpartx -dv /dev/loop0
-
Start the VM back up