I created an image of a failing drive with:
dd if=/dev/sde of=/mnt/image001.dd
The drive had only two partitions:
Device Boot Start End Blocks Id System
/dev/sde1 * 1 13 102400 7 HPFS/NTFS
/dev/sde2 13 60802 488282112 7 HPFS/NTFS
How can I split the image (image001.dd) into two or three files (1: MBR; 2: Partition 1; 3: Partition 2) so that I can mount the filesystems in it?
A solution I've found that wouldn't work for me is to use split
to create many 512K files, then cat
them back together into three files (1: 512K, 2: 105M, 3: the rest), but I don't have the disk space for that.
History:
I have already copied the entire image to a new drive, and it boots and mostly works. It seems that the FS was corrupted on the old failing drive, and dd
copied the corrupted parts (as it should), and I wrote them to the new drive. My solution is to mount the FS that I copied and the copy just the files (using rsync
or something) so that hopefully I won't copy the bad bits.
UPDATE 1: I've tried dd if=/mnt/image001.dd of=/mnt/image001.part1.dd bs=512 count=204800 skip=1
but mount
complains that NTFS signature is missing
, so I think I didn't do it right.
You don't need to split this at all.
Use
parted
to get details about the partition table:In
parted
, switch to byte units with the commandu
, thenB
. After that, issue the commandprint
.You will get an output that looks like this (output is from an actual system, not an image):
You can use the
Start
number as an offset for a loopback mount:would mount the third partition at
/mnt/rescue
.It's much better to simply use
kpartx
tool.Example:
At this point I can mount
/dev/mapper/loop0p2
.After unmounting call
kpartx -d whole_disk
to clean up.