How to recover an integer ext3 partition from a disk with a damaged partition table ?

Todd Denniston Todd.Denniston at ssa.crane.navy.mil
Wed Sep 24 16:33:02 UTC 2008


Andrea Mastellone wrote, On 09/24/2008 11:12 AM:
> Hi,
> 
> I have a broken solid state disk, in facts badblocks has found about a 
> hundred of damaged blocks. The most shortcoming is that I have lost the 
> partition table too, and I suspect that some bad blocks are in relation 
> with the partition table data since testdisk can not write the recovered 
> partition table to the disk. Now, I need to rescue a 10 GB ext3 
> partition (that is the last one on device).
> 
> So, I would like to use dd (or dd_rescue) to physically transfer the 
> partition in a file on an ext3 USB disk, and then mount the file as an 
> ext3 partition (like an iso file by means of loopback device, is it 
> possible ? how ?).
> 
> Since I am poor experienced with the CHS and LBA notations, someone can 
> me confirm this: testdisk signals that the partition begins at 6403, 1 
> ,1 and ends at 7798, 254, 63 in CHS notation. Since the disk has 255 
> heads and 63 sectors, the corrispective LBA addresses would be 102864258 
> and 125290810, isn't it ?
> 
> And, what of these data can I pass to dd (or dd_rescue) in order to 
> transfer the partition ?
> 
> Or can you suggest a better way to rescue the partition ?
> 
> Thanks in advance,
> 
> Andrea
> 

If I were in your situation and had enough GB on a spare disk to hold the 
whole SSD, I would do something like the following:
dd if=/dev/whole_solid_state_disk \
    of=/path/to/spareGB/SSD.image \
    conv=noerror bs=512

And then I MIGHT try some tricks to find the ext3 super blocks of the image, 
and/or dd about the last 10GB out of the image as a second image to do 
e2fsck's and loop mounting on.

if I had less space (and no time to buy an extra USB hard drive) and could 
translate the CHS to bytes/blocks of disk space, I would do something like:
assume 512 blocks, and HeadSector size of 7697074bytes
bc of 7697074*6402/512 yields 96243491 which is probably completely wrong.
(is this roughly a 55GB device?)

dd if=/dev/whole_solid_state_disk \
    of=/path/to/spare11GB/SSD.image \
    seek=96243491 conv=noerror bs=512


And remember, the device is already failing... you MIGHT only get one more 
read, so take that into consideration when choosing the method for getting the 
image.

-- 
Todd Denniston
Crane Division, Naval Surface Warfare Center (NSWC Crane)
Harnessing the Power of Technology for the Warfighter




More information about the fedora-list mailing list