[ltp] HDD emergency repair (howto)

Richard Neill linux-thinkpad@linux-thinkpad.org
Wed, 06 May 2009 09:29:02 +0100


Dear All,

I've just saved a friend's SATA notebook disk, and thought it might be 
worth writing up a brief account.

Symptom:
   Laptop wouldn't boot at all, stalling at the first BIOS screen.
   HDD wasn't spinning.
   Unplugging HDD allowed the laptop to boot via live-CD.
   => HDD faulty.

Confirm:
   There is nothing else that can be done with this disk. Professional
    data recovery is too expensive. So OK to take a risk.

Open the disk:
   Carefully, using a torx screwdriver.
   One screw is hidden under the label.
   Clean room would be nice, but I don't have one

Discovery:
   The head appears to have cold-welded itself somewhere in the
   middle of the disk. The disk can't spin at all. This is the
   second time I've come across a 2.5" disk with this problem.
   User says it wasn't mis-treated.

Solution:
   Carefully, without touching the platter, use a fingernail to
   force the head back into the parked position. Some considerable
   force (perhaps 10 newtons?) is required.
   Then quickly re-assemble drive before too much dust gets in.

Recovery:
   Put disk into thinkpad. Boot thinkpad from a live CD. (Mandriva 2009).
   Fortunately, the "dead" disk spins up.
   In the live-CD environment, add the package repositories, and install
   ddrescue.  (Note there are 2 similar programs: ddrescue and dd_rescue.
   I've had success with both.)

   Mount an external USB HDD. Let ddrescue do its stuff:
     ddrescue /dev/sda sda.img ddrescue.log
   After about 24 hours, ddrescue has recovered all 80 GB of the disk,
   excepting about 5 MB.
   Also, save fdisk info:
     fdisk -l /dev/sda > sda.fdisk.txt

Extract partition 1.
    dd if=sda.img of=sda1.img bs=512 skip=63    #value depends on fdisk.

    Mount the partition loopback:
      mount -o loop,ro sda1.img /mnt/tmp

    Note: it's supposed to be possible to do
       mount -o loop,ro,offset=32256 sda.img  /mnt/tmp
     but I found it didn't work.

    Note 2: It would normally have be easier to directly extract
    the partitions one at a time, at the ddrescue stage,
    But in this case, the offending disk is a Windows XP
    system, and I want to be able to re-image the OS onto a new
    drive. A filesystem-level copy won't work here. [In Linux, it's
    easy: just fdisk, mkfs, rsync, then fix fstab and install grub]

Recover data:
    copy stuff from /mnt/tmp

Re-image to a new disk:
    Plug in new HDD, boot from liveCD.
    dd if=sda.img of=/dev/sda


I hope that's useful to someone...

Morals of the story:
   (1) ddrescue is really useful.
   (2) Linux can do almost anything.
   (3) Even a totally stuck HDD can be saved without needing a cleanroom.
   (4) Having a USB-SATA adapter would be useful.

Best wishes,

Richard