kpartx is a very usefull tool if you work with raw images on virtual machines. Sometimes, when the machine does not boot anymore due bootloader problems, you want to just mount the root partition on your host machine. kpartx is what you want.
just use:
kpartx -a /dev/mapper/someimage
and you get blockdevices to mount.
!!! DANGER !!!
After unmounting you must use
kpartx -d /dev/mapper/someimage
or you will likely get corruption on your filesystem. I didn’t know that and I just thought that it would do some offset mappings and thats it, no need to unset them as it shouldn’t be buffered anyway. Wrong I was and caused luckily only a mild corruption that ext3 was able to fix without dataloss.
Comments
Comments are closed.