Mounting a partition from a raw DD image file of a physical disk
I have a DD image taken from the raw HDD image (/dev/sdb). This image file contains an XFS filesystem that I need to mount. It is much too large to restore to disks (2.6TB img file) so I would like to mount it using loopback.
However, the partition table becomes a problem. I tried to determine the partitions offset using both parted and fdisk -lu. Parted returns "unrecognized disk label", fdisk -lu shows me a blank partition table.
How would you recommend finding the partition start so that I can mount it with -o loop
Solution 1:
The kpartx
command will do all the work for you of detecting where the partitions exist and setting up loop devices with the appropriate offsets.
# kpartx -l /dev/ganderData/example-sysdisk
ganderData-example--sysdisk-1 : 0 497952 /dev/ganderData/example-sysdisk 63
ganderData-example--sysdisk-2 : 0 62412525 /dev/ganderData/example-sysdisk 498015
# kpartx -a /dev/ganderData/example-sysdisk
# mount /dev/mapper/ganderData-example--sysdisk-2 /mnt/tmp
Solution 2:
See if testdisk can find your partition labels. You can try and see if kpartx
can find and enable it first:
# kpartx -a -v image
Also remember to try those two things on a copy of the image. You don't want to destroy your backup image with tests.
Solution 3:
You can use sfdisk
to dump the partition table of the image. Pretty well any of the *fdisk
variants will do so, but some complain more than others. This will enable you to calculate the offset of the partition.