You have created an image of a hard disk. The hard disk is partitioned. You want to mount one of the partitions from the image file.
The problem here
Linux can use
/dev/loop? to turn an image file into a block device which can then be mounted. However the
/dev/loop? devices do not recognise partitions.
When mounting, you can use the
sizelimit= options to limit the range in the image file when mounting using loopback. If you place this area exactly on the boundaries of a partition, you can mount it.
You can determine the size and location of the partitions with
sfdisk (in this example the image of a USB stick with only one partition):
root@linux# sfdisk -d /tmp/image # Partitionstabelle von /tmp/image unit: sectors /tmp/image1 : start= 32, size= 20448, Id=83, bootable /tmp/image2 : start= 0, size= 0, Id= 0 /tmp/image3 : start= 0, size= 0, Id= 0 /tmp/image4 : start= 0, size= 0, Id= 0
The data here are in blocks of 512 bytes. The conversion can be done for you by the shell, for example. The mounting is performed with the following command:
root@linux# echo $((32 * 512)) $((20448 * 512)) 16384 10469376 root@linux# mount -o loop,offset=16384,sizelimit=10469376 /tmp/image /mnt