July 12, 2008
Kpartx can be used to set up device mappings for the partitions of any partitioned block device. It is part of the Linux multipath-tools. With
kpartx -l imagefile you get an overview of the partitions in the image file and with
kpartx -a imagefile the partitions will accessible via
/dev/mapper/loop0pX (X is the number of the partition). You can mount it now with
mount /dev/mapper/loop0pX /mnt/ -o loop,ro. After unmounting you can disconnect the mapper devices with
kpartx -d imagefile.
There are packages for Debian and Ubuntu.
- Ubuntu: http://packages.ubuntu.com/de/hardy/kpartx
- Debian: http://packages.debian.org/search?keywords=kpartx