Tag: disk image
Mounting partition in disk image
by BenV on Jul.22, 2011, under Boring
This is already 20 times on google, but I hate searching so here we go another time.
And without tools that slack doesn’t have. Just the normal (s)fdisk etc.
Steps:
1. Figure out start offset for your image. You’re interested in “sectors of X bytes” and the number in the “Start” column for the target partition.
root@images:~$ sfdisk -lu sources.img
unrecognized format - using sectors
Disk sources.img: cannot get geometry
Disk sources.img: 261 cylinders, 255 heads, 63 sectors/track
Units = sectors of 512 bytes, counting from 0
Device Boot Start End #sectors Id System
sources.img1 63 4192964 4192902 83 Linux
sources.img2 0 - 0 0 Empty
sources.img3 0 - 0 0 Empty
sources.img4 0 - 0 0 Empty
2. Convert the offset in sectors to bytes by multiplying the two numbers you read from the output.
63 * 512 = 32256
3. Mount with an offset:
root@images:~$ mount -o loop,ro,offset=32256 sources.img /mnt
Done.