Feb 052014
 

I accidentally changed some configuration of a VM and it refused to start after reboot, I know I can simply revert what I changed to make it works again so to avoid recovery process, and I found this great article which described exactly what I want. I’m going to repeat the steps here as I also need to write steps to unmount. Note that you need to have kpartx installed.

Most VMs are in volume group, so here are steps to mount the VM image:
[shell]
sudo losetup /dev/loop0 /home/VM/vm1/disk.img
sudo kpartx -a /dev/loop0
sudo vgscan
sudo vgchange -ay
sudo vgscan
# figure out name of the volume group by comparing output of two vgscan
sudo mount /dev/vg_name/lv_root /mnt
# now you can go to /mnt/etc to edit those configurations, then
sudo umount /mnt
sudo vgchange -an vg_name
sudo kpartx -d /dev/loop0
sudo losetup -d /dev/loop0
[/shell]

Sorry, the comment form is closed at this time.