Editor’s Note: Tip Top Tips is a semi-monthly column in The PCLinuxOS Magazine. Periodically, we will feature – and possibly even expand upon – one tip from the PCLinuxOS forum. The magazine will not accept independent tip submissions specifically intended for inclusion in the Tip Top Tips column. Rather, if you have a tip, share it in the PCLinuxOS forum’s “Tips & Tricks” section. Occasionally, we may run a “tip” posted elsewhere in the PCLinuxOS forum. Either way, share your tip in the forum, and it just may be selected for publication in The PCLinuxOS Magazine.

This month’s tip comes from kjpetrie.
Texstar has already suggested a remedy for this, but his method seems to require systemd, which in our case we have not got.
However, our current initscripts package already contains a mechanism for doing this, which needs just one small change to a configuration file to make it do a check. In /etc/sysconfig/autofsck change the line:
# Specify if we do automatic fsck.
AUTOFSCK_DEF_CHECK=no
to
# Specify if we do automatic fsck.
AUTOFSCK_DEF_CHECK=yes
If, and only if, your system is not properly shut down it will run fsck on boot before mounting partitions. I have just seen it in action after a hardware conflict reset my system. All four of my mounted partitions were checked in turn and corrected before my eyes as the system restarted. My home partition displayed a growing row of equal signs as the check proceeded.
The mechanism relies on rc.sysinit creating a hidden file called /.autofsck on every boot. The halt script deletes that file. Hence, it will never exist until it is created on boot on a system which ran halt to its conclusion. Before creating it, rc.sysinit checks if it does not already exist, and if it does, checks /etc/sysconfig/autofsck for instructions. By default, PCLinuxOS has the line set to no, but if you change it to yes you will get automatic checking when needed.
Discussion
Some users already had the setting enabled on their computers (sixte and myself were among those users). However, many other users did not already have this setting enabled (meaning it was set to “No”).
The commands “fsck.mode=force fsck.repair=yes" appear to be silently ignored on PCLinuxOS, because we haven't got the program (systemd) which implements it.
Forum user Stingray provided a way for users to check to see when the last time fsck ran on their computer. Enter tune2fs -l /dev/[drive] | grep checked at a command line prompt, replacing [drive] with the drive device designation on your computer. If you’re not sure what the drive designation is for your drive(s), simply open GParted and look at the drive designations there. Use those drive designations to complete the command and to get your answer. Remember: you’re ONLY opening GParted to see what the drive designations are for your drive(s). Once you’ve written down the drive designation(s), close GParted without doing anything else. You’re only using GParted as a fact-finding mission.
While the ext4 filesystem (default in PCLinuxOS installations) has improved the stability for your filesystem, it’s not necessarily bulletproof. If your computer does not shut down properly, or if you’re forced to do a forced restart, you could end up with some damaged files from the system being unable to properly close those files. This tip definitely helps alleviate those fears, and helps fix any problems that may result from an unclean shutdown of your computer.
|