Mounting Partitions *inside* a dd Image

Andrew Heagle andrew-vUgxaBqSMS7QT0dZR+AlfA at public.gmane.org
Wed Jan 27 03:36:33 UTC 2010


On Tuesday 26 January 2010 18:48:44 Mike Kallies wrote:
> Hello Everyone,
>
> I have a disk image which was taken several years ago using "dd".  I
> want to try to recover the data from the image, but I don't want to have
> to copy it back out to a disk.
>
> If I were smart, I could have done
>
>   dd if=/dev/sda1 of=sda1.img
>   dd if=/dev/sda2 of=sda2.img
>   dd if=/dev/sda bs=512 count=1 of=sda-bootsector.img
>
> But instead, I did
>
>   dd if=/dev/sda of=sda.img
>
> So now, years later, I've got this blob which I can't quite mount.
>
> Does anyone know a trick to mount the partitions inside the image?
>

Hi,

You can use the kpartx utility. Installed by default on CentOS. Can apt-get it 
for Ubuntu.

Just run `kpartx -av sda.img` (as root) and you should see what the names of 
the partitions will become (probably /dev/mapper/sda.img[12]

If it doesn't use LVM, you can just mount them like a normal disk partition.

If a partition uses LVM, you'd have to use vgimport, vgchange to mount the 
LVs.

Regards,
Andrew

--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list