repairing filesystem corruption on ubuntu / xubuntu
Customer called, saying he has a ubuntu system, but it stopped booting up correctly, and mentions things like fsck, and unmounting filesystems. He also admits that he pulled the power on the PC, instead of shutting it down correctly…
Over the phone, I manage to figure out that the root filesystem needs to be checked, but it seems that theres a catch-22 situation (which is, unfortunately, very common amongst many modern OS’s): main filesystem is corrupt, so OS cannot start… but filesystem cannot be fixed unless the OS starts…
He wasn’t given a ubuntu CD, so I download the latest ubuntu (7.10) burn it to cd, and pay him a visit.
When I get there, it looks like he has xubuntu, but all linux distros should have standard filesystem types (ext2, ext3, reiserfs, etc)… so it shouldn’t be a problem.
I boot from the CD, find I need to do fsck /dev/sda1 but its currently mounted.
OK, I try umount /dev/sda1, but I’m told /dev/sda1 is not in the fstab file… I eventually umount it (indirectly) by using parted
but when I try to fsck /dev/sda1 I’m still told it is mounted (and I’m not root anyway).
I try to login as root, and to su – root, but I don’t seem to have the correct password.
At this point, some research is in order. So I connect up my temp PC to the customers internet, and find out that ubuntu disables the root account (but that administrator commands can be done by using the sudo command).
Ah, this feels a bit more secure than most linux distros I’ve seen… I might take a closer look at ubuntu in the future.
Anyway, I run: sudo fsck /dev/sda1
And after about 5 minutes, it completes, with what looks like a few minor errors (which got corrected).
I remove the live CD, and restart the PC… and this time it starts correctly. Good.