Mounting specific partition from inside a disk image in linux.
Step 1 : Find the partition structure in the disk image file.
# fdisk -lu disk.img
Step 2 : The screen above says that 1 sector = 512 bytes, so if you want to mount the third partition in this, use the math :
Partition stating point = offset x 512 = 17803264 * 512 . Then use the following command.
# /sbin/losetup /dev/loop1 disk.img -o $((17803264 * 512))
# mount -o ro /dev/loop1 /mnt/target
If the partition contains a real filesystem, you should be able to access the data in the partition. Once you are done, you can use the command to clear the device node.
# umount /mnt/target
# losetup -d /dev/loop1
Hope this helps you !! Thanks.