Mount a partition from dd-created image of a block device (e.g. HDD) under Linux

on February 16th, 2015 by Hades | No Comments »

I have an image of the entire disk created using dd. The disk structure follows:

fdisk -l /home/hades/Downloads/legko_client.dd

Disk /home/hades/Downloads/legko_client.dd: 2 GiB, 2147483648 bytes, 4194304 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00047c7a

Device Boot Start End Sectors Size Id Type
/home/hades/Downloads/legko_client.dd1 8192 122879 114688 56M c W95 FAT32 (LBA)
/home/hades/Downloads/legko_client.dd2 122880 3788799 3665920 1.8G 83 Linux

No need to use offsets or kpartx anymore:

losetup --partscan --find --show /home/hades/Downloads/legko_client.dd
mount /dev/loop0p2 /media/floppy