Saturday, June 19, 2010

Restoring My Linux drive

Last week, while I was using my Linux machine the windows manager crashed. Menu bar disappeared, programs shut down, kaput... When I rebooted, it told me during the file system check that something was wrong and that was it. No more booting.

Fedora is a little annoying because during boot up it doesn't show you the start up message unless you hit F8 although the message didn't really help since it said that it couldn't find the UUID of the drive which can be misleading. Most posts on it talks about how UUID mismatches between your /etc/fstab and the actual drive's UUID causes the message. For me, that wasn't the case since what happened was that Linux was unable to find the drive, but the message along with "Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK" in the dmesg log did help me figure out that the problem was with a particular drive (I have two in the linux box).

My first guess was that that partition table was corrupted, but I couldn't use any standard utility to fix it since Linux couldn't mount the drive at all. I feared that it was a hardware failure and I'd have lost all my data (I had an older backup, but prefer to rescue the most recent data if I could). I take out the drive and replaced it with a new drive, booted it up with a rescue disk and recreated the partitions that was on the drive. Initially, the system didn't see the drive and for a moment I thought, "Oh no, don't tell me the controller board is fried 'cause that means having to buy a new motherboard." Calmness prevailed and I realized that I put in a new drive and my motherboard most likely didn't support 3 Gb/sec SATA drive. I put in the jumper that put the drive at 1.5Gb/sec and the system recognized the new drive. That allowed me to boot up the machine again.

Next thing was to see if I can rescue the data on the drive. I put the old drive into an external USB enclosure and plugged it into the Linux box. No dice, Linux still couldn't do anything with it. I then plugged it into a macbook that had macfuse and support for ext2/ext3 file system and the data partitions came up! Now I wanted to copy over the data as quickly as I can in case the drive really fails, but OSX was pretty crappy at it. It would stop or complain and couldn't get through the copying for various reasons including that it isn't a case sensitive file system and so when it runs into errors it would abort the whole copy.

Reformatted my portable backup drive to be case sensitive and used rsync instead. Once I copied all the files over, I plugged the USB drive into my linux box to restore the files. Of course, Fedora boots into the GUI interface and I needed to copy the files over first so that the GUI can boot in correctly. Fedora won't let you boot into the GUI as root so you'll have to be at the machine and using CTRL-ALT-2, go into the console and log in.

I was then able to copy over all my files and get back to work!

No comments:

Post a Comment