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):
- Buy a new hard drive
- Install Ubuntu fresh
apt-get install make gcc g++ ddrescue
tar xzvf dd_rhelp-0.1.2.tar.gz
cp dd_rhelp /bin
- Plug in the dying hard drive and mount it (for arguments sake /dev/hdd4)
- Mount the new drive (for arguments sake /dev/hda3) with a lot of space
dd_rhelp /dev/hdd4 /dev/hda3/backup.img
- This will take ages (i.e. 10 hours for my drive) as it copies the entire partition (including empty space) to that img file.
- When it’s done, poweroff and unplug the dead drive, then reboot and run
fsck /dev/hda3/backup.imgto clean it of errors.
- Mount the img file by using something like
/mnt/hda3/backup.img /mnt/recover ext3 defaults 0 0
- If everything has worked, your recovered files should be in the lost+found folder in that drive.
- Get down on your knees and thank God! Then go backup.