Sometimes we need to mount a partition stored in a dumped hard drive image. This howto will learn you how to cope with this sort of problems. You will also learn how to make such partition visible to the whole system resources. MOUNTING HARD DRIVE IMAGE PARTITION Prerequisities: fdisk, bc, mount, umount Howto: 1. use fdisk to get the start of a partition in sectors 2. multiply the start position by sector size to get the right offset 3. mount the partition at obtained offset fdisk -lu /tmp/hd.img Disk /tmp/hd.img: 40.0 GB, 40007761920 bytes 255 heads, 63 sectors/track, 4864 cylinders, total 78140160 sectors Units = sectors of 1 * 512 = 512 bytes Device Boot Start End Blocks Id System /tmp/hd.img1 * 63 192779 96358+ 83 Linux /tmp/hd.img2 192780 19727819 9767520 83 Linux /tmp/hd.img3 19727820 74413079 27342630 83 Linux /tmp/hd.img4 74413080 78140159 1863540 82 Linux swap / Solaris Interested in the columns titled "Start" pick up the number where the partition you need to mount starts and multiply it by sector size which information can be found in the line starting "Units". For the third partition it will be: echo '19727829 * 512' | bc 10100648448 Now, mount the partition somewhere. mount -o rw,loop,offset=10100648448 /tmp/hd.img /mnt If everything went OK you have now /tmp/hd.img3 mounted on /mnt directory. Do not forget to umount it after you finish your work with it. umount /mnt WORKING WITH HARD DRIVE IMAGE PARTITION ITSELF Prerequisities: fdisk, bc, losetup Howto: 1. use fdisk to get the start of a partition in sectors 2. multiply the start position by sector size to get the right offset 3. setup loop device fdisk -lu /tmp/hd.img Disk /tmp/hd.img: 40.0 GB, 40007761920 bytes 255 heads, 63 sectors/track, 4864 cylinders, total 78140160 sectors Units = sectors of 1 * 512 = 512 bytes Device Boot Start End Blocks Id System /tmp/hd.img1 * 63 192779 96358+ 83 Linux /tmp/hd.img2 192780 19727819 9767520 83 Linux /tmp/hd.img3 19727820 74413079 27342630 83 Linux /tmp/hd.img4 74413080 78140159 1863540 82 Linux swap / Solaris We picked up second partition for this example: echo '192780 * 512' | bc 98703360 Get next unused loop device: losetup -f /dev/loop0 Setup the loop device: losetup -o 98703360 /dev/loop0 /tmp/hd.img You can now work with the loop device in a way as if it were regular hard drive partition. Check: http://vger.cz/hacks/awk/mountraw.awk