linuxfilesystemsmountloopback

How to mount one partition from an image file that contains multiple partitions on Linux?


The image file has a partition table, and it contains multiple partitions.

loopback devices might be a possibility.

Related threads:


Solution

  • Let's say $IMAGE is set to the path to your image file. You could write a small script by using

    fdisk -u sectors -l $IMAGE
    

    to get a list of partitions inside the image. And then use a sequence of

    mount -o ro,loop,offset=$OFFSET -t auto $IMAGE /media/$DEST
    

    Where offset is calculated means the info from fdisk (start sector * size of a sector in bytes) and $DEST a unique name for each of the partitions.

    That's not directly the solution but I hope a pretty good indication on how to realize it. If you make the job once, you've some small nice beginning for some forensic toolkit!​​​​​​​​​​​​​​​​​​​​​