21 November, 2011

Reparing corrupted root system partition in Ubuntu 10.10

Usually, they say that Linux is unbreakable. This statement might be correct to certain degree, but only if you understand how Linux works.
Recently, I had a problem of booting Ubuntu installation. Took me a whole week to find a solution, which came in the nick of time, since I was preparing to wipe out Ubuntu installation. Apparently, it was a root filesystem problem.

I have a real jinx among my friends. That person is responsible for failures of tons of devices, as they mysteriously malfunction as soon as he mention them. We had a conversation in which he deliberately mentioned my hard disk in some context and whaaaam! Tomorrow, Linux root partition collapsed. 

Booting of GRUB was ok, but as soon as Ubuntu starts loading (normal or recovery-mode), initramfs is displayed on console, suggesting that root partition was not loaded for some reason. Did some research online and most clues pointed that ext4 filesystem on partition might be corrupted. 
I had no idea what I did to corrupt partition. Only explanation was that my jinx friend somehow "manipulated dark matters of the universe" to cause "cascade failure" of my filesystem. I won't worry so much if that was NTFS, as they tend to malfunction from time to time. Don't get me wrong, NTFS is stable enough, but I had  experiences when Windows system partition collapses. That is a reason why you should always make lots of partitions to prevent losing your data.
Next thing that I did was booting Ubuntu LiveCD 10.10 and running Disk utility (from administration menu) to scan partitions for errors. As I suspected, root partition (in my case /dev/sda15) had an error that is reported like: "File system is NOT clean". More Google about that thing... Yup, that "NOT clean" is somehow "common" in Linux and it is nothing serious, since it doesn't really mess up your files. However, if root partition is not clean then it prevents you from booting your system though... 
Deal is to unmount corrupted partition (if mounted) and to run e2fsck program to fix your partition automatically. Sounds easy enough... In dreams perhaps...
I entered following commands in console and output is quite "logical":
ubuntu@ubuntu:~$ sudo umount /dev/sda15
umount: /dev/sda15: not mounted

ubuntu@ubuntu:~$ sudo e2fsck -f -v /dev/sda15
e2fsck 1.41.12 (17-May-2010)
e2fsck: Device or resource busy while trying to open /dev/sda15
Filesystem mounted or opened exclusively by another program?
I understand that unmounting unmounted file system is not possible (liveCD don't mount your partitions automatically), but check next line: "Not mounted" and later "Filesystem mounted or opnened?". Who is crazy here?
When something goes wrong in Open Source world, you should always rely on community. Fortunately, Ubuntuforums.org is full of experts and enthusiasts that will gladly help you, or at least hint you where to look for answer.
Sounds too unreal? Check it for youself! I posted my problem and it didn't take long to get an answer. My savior did my homework and found that version of exfsck found on Ubuntu 10.10 live cd is bugged?!?!? This is very serious omission on Ubuntu's behalf and is definitively not cool.
Wanted to download Ubuntu 10.04, but I found that I had LiveCD of 9.04 version so I used it instead. Booted up successfully and opened console to execute given commands and e2fsck executed without any problems. Interestingly, command exfsck executed in a split-second! Obviously problem was not so serious after all.
Restarted (again...) computer, and voila! Ubuntu boots up and system is restored.

More Linux experience gained, attained next experience level and another Open Source case closed... (I have impression that I am getting good at this) :D

No comments:

Post a Comment