Oct 09

Mounting Partitions from Image Files on Linux

I’ve been working with disk images from the excellent crew from Hypriot and there are times when I wish to mount the filesystems within to inspect and or make alterations to them. Since there are multiple filesystems, it’s not like mounting an ISO image — there’s more work which needs to be done.

Being a “lazy”(pronounced SMART) sysadmin type, I did some research and discovered a wonderful tool called kpartx — it will read the partition table of the image and create device mappings for the partitions.

Typically it is called as follows:

Note: despite the line saying /dev/loop2, the partition’s synthetic device is actually at /dev/mapper/loop2p1

Leave a Reply

%d bloggers like this: