Disk Recovery
Well, that was pretty cool, I just managed to recover the data off of a dying 30GB hard drive on my friends laptop. It was surprsingly easy, all I really needed was time.
First of all I downloaded and burnt off the latest beta of SystemRescueCD. After booting from that on the laptop, I set up the networking on it and downloaded dd_rhelp from freshmeat. I then mounted I directory on my main desktop machine via sshfs on the laptop and ran the following command:
./dd_rhelp /dev/sda1 /mnt/ssh/backup.img
That command basically uses the dd_rescue tool on the SystemRescueCD to copy the first partition of the first hard drive into a file on my desktop computer (via the sshfs mount point at, you guessed it, /mnt/ssh). dd_rhelp is nice because it makes the process faster apparently but leaving all the bad sector, I/O error retrying till the end, instead skipping over errors when they happen in order to copy the actually working stuff first. Then it goes in and fills in the blanks. I left this running for about 16 hours after which it had all of the drive except for about 0.5MB which just would not copy. I cancelled the copying at this point and went to work on the backup image on my desktop.
First of all I backed up the backup image. Some of the things I might do to it could be destructive and I don’t want to wait another 16 hours to grab the data again, if the drive will even work. On the backup, I then ran the following command:
fsck.vfat backup.img -rw
This scanned the filesystem in the backup image (in this case FAT32) for errors and asked me to choose a way to fix them. I basically told it to not mess around with anything except broken filenames and incorrect cluster sizes under the assumption that if this could actually see files to mess around with, chances are I didn’t need to play with the actual FAT table on the disk.
After running that and writing the changes to the image, I mounted the file into my system and copied off all the data my friends would most likely want (the entire Documents and Settings folder in this case) and burnt it all onto a DVD for them. I’ll keep the hard drive image around in case they discover there is something else they need in the next few weeks but yep, that was it. Easy.
I must say I was damned impressed with SystemRescueCD, it’s chocablock full of very useful tools and it’s ability to do networking and it’s provision of ssh tools makes it very nice to work with indeed. I could not have done this without it. Well, actually that’s a lie, I was prepared to burn a customised copy of DSL with all the tools I needed compiled and built into it but luckily I found SystemRescueCD before I wasted my time on that.
Fun stuff.