Sep 17, 2010

Rescuing Broken Filesystem (Ubuntu 10.04)

Okay so I did something wrong when using Ubuntu. Don't ask me what I was doing hundred things at the same time and it could of been one of those things or mix of few things. Either way borked my nice Ubuntu 10.04 machine that I spent hours tweaking and customizing. I didn't realize I did anything wrong until rebooted.

When I rebooted instead of seeing my UPower Splash Screen I saw some scrolling text. You now the type that Newbies get really scared of. I thought ah not a big deal as long as it boots. Then I saw the famous (INITRAMFS) scroll up the screen. This was followed by some more text that list my devices on my computer. Then it just stayed that way.

I tried rebooting several times expecting different result. I know I'm insane like that. But I got the same result 3 times. Since I never install Ubuntu with the LiveCD and I usually use the Alternate installer because I can be more flexible with it. I only had the Alternate Install Disk. I hopped on to my Laptop of mine and got ready to download the LiveCD to make my rescue much easier. Why I was waiting for my LiveCD ISO image to download I decided to pop in the Alternate Install CD knowing that it has a Rescue Broken System Option.

I chose check Disk for Defects to make sure the CD was not corrupt. Everything Checked out. So I decided to reboot back into the Alternate Install CD and choose the Rescue option. So I did just that.

I then got to a screen that asked me if I wanted to boot from the shell, reinstall the grub bootloader, reboot my system and 2 other options that I can't remember. Run the shell. After this I was asked what device my root filesystem was on. Their where 3 options. sda1, sda2 and sda5. I had no idea but took an educated guess and chose sda1. Then I got sent to the shell as root user.

From here typed the good old fsck -t ext4 /dev/sda1 command. This command tells the system to check and repair any problems in filesystem. Of course I knew that Ubuntu 10.04 installs on an ext4 filesystem. If it was on an ext3 or ext2 filesystem I would have typed the following.

fsck -t ext3 /dev/sda1

You could do this for fat filesystems also if your using one such as Windows. Of course sda1 would also be different if Ubuntu was installed on different drive. But since I believed it the root filesystem was installed on sda1 and was correct I decided to use that and it turned out I was right.

After I issued the commands I typed reboot. Since I was in the shell as a root user I didn't need to use sudo reboot just reboot. Then I the Live CD started once again. I then chose to boot from Hard Disk. When I did this I saw the UPower screen yippy. It was running check on the system and making sure everything was fine. Then my System Started up just fine. To make everything was perfect from their on out I decided to reboot my system once again. After I did this the system started just fine. I didn't have to wait for UPower to run check on the System.

One of the most rewarding things is to rescue system that you have spent hours working on and you really don't want to have to do it over again.

No comments: