How to mount a raw disk image taken with dd

To mount a raw disk image is pretty simple.

Create your mount point

Create the place where you intend to mount the image’s file system.

Examine your disk image file:

As you can see the image contains 3 partitions.

For a more detailed view use fdisk:

So as you can see our image contains 3 partitions. The partition we are interested in mounting is the boot partition systemBackup.img1.

Before we mount it we need to know how much into the file in bytes our partition is so we can define the offset. In our case you can see that it is 2048 sectors in. You can also see that each sector is 512 bytes long. So from that we can deduce that our partition starts 1048576 bytes in (2048 * 512)

So now we can mount it with:

The ro option mounts it as read only which is probably a good idea if you are just trying to recover some files.

If we want to be lazy and not bother with calculating the offset our self’s we can let our terminal do the work for us instead:

Now to check if we mounted it successfully:

Now we can just go straight to our files:

All good!

Posted in Linux