fsck (filesystem check) program is a must run app to maintain the health of your OS. Your disk will not last with the constant read/write activities you make to your hard drive. Overtime, the physical parts of the drive will fail causing data loss, system boot problems or complications logging in. Like the Disk De-fragment in windows used to place all data in an easy accessible table and bad sectors in an area loneliness, fsck follows this same process. Your drive will develop bad sectors and cause the device to perform poorly. Even a system update could cause this. I say run “fsck” every weekend just before you marry your pillow. Your system will like you in the morning.
My brother had a problem with his Xubuntu 12.04 desktop machine. He could not log into his account. I thought, not knowing any better, that he was not putting in the correct password. After I attempted, and I know how to spell, I notice the login manager, lightdm, would not log into the account. Very strange. There were only two accounts, “guest” and my brother’s account. I logged using “guest”.
Once in the guest account, I opened the “user account” application. All settings were checked, and all were correct. Of course I was only a guest and needed administration privileges. After running su -l (brother’s account), the terminal said, “no /home folder found, running as root“. No /home folder found? I ran “ls” on /home and noticed that my brother’s home folder was missing. How that happen, don’t know. My brother’s home folder is located on a separate partition. Thankfully. His data was still available from that location. That partition was supposed to be mounted during boot to the /home subdirectory on the system root directory. I took a look at “fstab” to get a glimpse of what was being mounted. Well, /home was one of the mounted filesystems. I had an idea of a funny tweak, but held back and decided to first check the filesystem integrity on the hard drive.
My favorite tool for this job was “fsck“. Fsck stands for, “filesystem check” and is used to check the filesystem structure for bad areas and attempts to fix them. Before I permanently destroy my brother’s machine and blame it on him, I thought it would be safer to run “fsck” first and see if that fixes the problem. I used a very cool linux administration liveCD knoppix that uses the 2.6.x kernel. This is a cool system to have in your linux toolbox. Booted up the live system and heard a soft female voice say “system starting up“. Felt like I was in the U.S.S enterprise from star trek. This system is still pretty old but looks so modern. A terminal was opened, ran “sudo fdisk -l” to get a list of the partitions on the hard drive. I only targeted one partition. The one with my brother’s profile on it. Ran #sudo fsck /dev/sda5 and got a screen full of bad sectors. What was my brother doing with his computer? After all the sectors were moved and every file recovered, the check completed, and I rebooted the system. “system is now shutting down“, love hearing that voice. Booted my brother’s primary system and, presto, I was able to login to his profile.
What I have learned
Whenever you are experiencing system errors, lost files, system won’t boot, can’t login, check your system for bad sectors by running “fsck” first. Chances are, your hard drive was taking on lots of wear and tear. Run “fsck” regularly to keep the system healthy.
A cool site that explains “fsck” in more detail.
If you need any help with computer maintenance, either windows or linux, or want help in getting your old PC running on new legs, leave a comment or follow my g+ page.