Recovering a dead hard drive in Ubuntu

So, as my previous post outlined, I came to the realisation that this blog would be a good idea right about the time I started to hunt through the internets to fix my broken hard drive.

A recap – I booted up my Ubuntu (7.10 Gutsy Gibbo) box, only to have it come up with a series of errors as fsck tried to locate bad inodes. What appeared to have happened is that there were one or more bad sectors on my primary boot disk (a 200GB Seagate Barracuda) – sectors that happened to be right where Linux needed them to boot.

Booting into Ubuntu with a live CD only proved heartbreaking – the only other bad sectors on that disk were my photos! Thousands of un-backed up images. Let’s just say some choice phrases were used at this point.

A number of remedies were attempted, but the one that worked in the end was to take an image of the whole partition and use ddrescue and dd_rhelp. Basically, this is what I can remember (I’ll try to be more complete on future posts):

  1. Buy a new hard drive
  2. Install Ubuntu fresh
  3. apt-get install make gcc g++ ddrescue
  4. wget
  5. tar xzvf dd_rhelp-0.1.2.tar.gz
  6. cd dd_rhelp-0.1.2
  7. ./configure
  8. make
  9. make install
  10. cd ..
  11. cp dd_rhelp /bin
  12. cd /bin
  13. Plug in the dying hard drive and mount it (for arguments sake /dev/hdd4)
  14. Mount the new drive (for arguments sake /dev/hda3) with a lot of space
  15. dd_rhelp /dev/hdd4 /dev/hda3/backup.img
  16. This will take ages (i.e. 10 hours for my drive) as it copies the entire partition (including empty space) to that img file.
  17. When it’s done, poweroff and unplug the dead drive, then reboot and run fsck /dev/hda3/backup.img to clean it of errors.
  18. Mount the img file by using something like /mnt/hda3/backup.img /mnt/recover ext3 defaults 0 0
  19. If everything has worked, your recovered files should be in the lost+found folder in that drive.
  20. Get down on your knees and thank God! Then go backup.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s