3

I've a disk image done with dd:

dd if=/dev/sda of=/mnt/fulldisk.img

/dev/sda have some partitions (Windows+Linux)

My problem is: I need to know if the image is done well, how can I access data? (especially Linux data)

I've tried with Windows utilities like ext2explorer or directly mounting the image, but I cannot access data.

Is there a way to do it (with Windows or Linux)?

Hubert Kario
  • 6,361
  • 6
  • 36
  • 65
Ferran
  • 31
  • 1
  • Can you post the command and the error you got when you tried this? – Khaled Jan 16 '12 at 07:56
  • There's no error (i'm trying to mount it in windows), simply, don't do nothing, when I try other ways i get some 'data corrupted' message (but i think that's the system get some raw data that it cannot undestand. – Ferran Jan 16 '12 at 08:14
  • Did you try to mount it under Linux? Linux can understand Windows partitions as well. – Khaled Jan 16 '12 at 08:20

2 Answers2

2

In Linux you can use kpartx. First see with kpartx -l /mnt/fulldisk.img to see if it can recognize the partition layout. If it can, kpartx -a /mnt/fulldisk.img makes your partitions available under /dev/mapper/loop0pX where X is partition number.

You can then mount those partitions with

mount -o loop /dev/mapper/loop0pX /some/mount/point

Just replace X with your desired partition number.

After you are finished, use umount /some/mount/point and kpartx -d /mnt/fulldisk.img to properly disconnect your disk image.

Janne Pikkarainen
  • 31,852
  • 4
  • 58
  • 81
  • 1
    Thanks a lot! There's a way to do it under windows also? With linux, I've found also those method: get and calculate the offset of the partition and mount using: mount -o loop,offset=xxx image /mnt but it seems a very raw option... – Ferran Jan 16 '12 at 08:36
2

All recent kernels (it was added somewhere around 2.6.2x) support partition tables on loop devices. Only the default is to disable this.

modinfo loop should give you information whatever it supports a max_part parameter. If it does, add to modprobe.conf

options loop max_part=16

and do rmmod loop and modprobe loop (all loop devices must be unused for it to work). This way, when mounting a single image using a loop device, all partitions will be automatically available:

losetup /dev/loop0 /mnt/fulldisk.img
mount /dev/loop0p1 /mnt/part1
mount /dev/loop0p2 /mnt/part2
Hubert Kario
  • 6,361
  • 6
  • 36
  • 65