Last Updated: February 25, 2016
·
717
· osallou

Mount the partition of a disk image

As root:

losetup /dev/loop0  /path_to_my_imagefile.img
kpartx -a /dev/loop0

This will create loopback: /dev/mapper/loop0p1 (for partition 1).

you can then mount the partition:

mount -t ex3 /dev/mapper/loop0p1  /mnt/my_mount_dir

Once your modifications are done on the partition, undo everything:

umount /mnt/my_mount_dir
kpartx -d /dev/loop0
losetup -d /path_to_my_imagefile.img