Mount a prtition from a diskimage with linux
While duplicating CF cards for a Project running on ALIX boards. A had the need to change something on the Diskimage which I am duplicating.
But this image was a dump of the whole CF card, including MBR, partitiontable and so on. So some magic has to be done...
First we have to find out where the partition starts inside the diskimage. The easiest was is to use parted to find that out:
cramer@fiji:~$ sudo parted swissix-oob-2010-05-05.img
GNU Parted 2.2
Using /home/cramer/swissix-oob-2010-05-05.img
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit
Unit? [compact]? B
(parted) print
Model: (file)
Disk /home/cramer/swissix-oob-2010-05-05.img: 4017807360B
Sector size (logical/physical): 512B/512B
Partition Table: msdosNumber Start End Size Type File system Flags
1 32256B 4017291263B 4017259008B primary ext2 boot(parted) quit
So this means that the first and only partition in this case starts at offset 32256.
Now we can mount this partition with the loop module:
sudo mount -o loop,offset=32256 swissix-oob-2010-05-05.img /mnt
That's it. Easy if you just know it....