Hidden Linux : What the fsck?
Linux's file system check utility fsck is
little recognised and largely unloved, no doubt because it seems to
know whenever you're in a hurry to boot your machine. Then - and why is
it only then? - it starts doing what it was designed for: checking the
consistency of the filing systems on your hard drives and making any
necessary repairs.Since Ubuntu 9.04 users have at least had the option of hitting the Esc key to cancel the process, (users of earlier versions might like to consider Bonager), but what's actually going on and why does the checking seem so intermittent?
All file systems accumulate errors over time, often the result of application crashes, improper shutdown or bugs. Checking and recovery tools should be run periodically and fsck simply automates the process by setting a counter and checking off how many times each filing system has been booted. (It has to be done at boot as fsck can't be run over a mounted partition.) And that apparent randomness actually isn't. fsck typically sets the default boot count at 30 meaning that with daily boots your file systems will be checked once a month.
In Linux of course you can control everything. If you want all your file systems checked next time you boot simply enter the command;
sudo
touch /forcefsck |
That simply adds an empty file to the root directory ("/") called forcefsck, the presence of which instructs the kernel to check everything.
You can also change the checking interval or even turn it off completely, but before you do anything else type
sudo
fdisk -l |
to remind yourself of what's mounted where.
The key command in controlling when fsck runs is tune2fs. You can use either count-dependent or time-dependent checking;
sudo
tune2fs -c 15 /dev/sda1 |
will check the filesystem on /dev/sda1 every 15 mounts while
sudo
tune2fs -i 60d /dev/sda2 |
will check the filesystem on /dev/sda2 every 60 days. (This interval could also be written as
-i 8w
- every 8 weeks or -i 2m -
every 2 months.)You can even turn off checking completely by setting either the count or interval to 0 or -1
sudo
tune2fs -c 0 /dev/sda3 |
but this is not recommended!
Bad
disk drives, cables, memory, and kernel bugs could all corrupt a
filesystem without marking the filesystem dirty or in error. If you
are using journaling on your filesystem, your filesystem will never be
marked dirty, so it will not normally be checked. A filesystem error
detected by the kernel will still force an fsck on the next reboot, but
it may already be too late to prevent data loss at that point.
The -C option is used to set the number of times the file system has been mounted, meaning you can use it to stagger when they're due to be checked. Assuming you've just re-booted after setting
sudo touch
/forcefsck ... sudo
tune2fs -C 1 /dev/sda1 sudo tune2fs -C 2 /dev/sda2 sudo tune2fs -C 3 /dev/sda3 |
... will change the counts so that the partitions will be checked on consecutive boots, not all at once.
<--Previous Hidden Linux Next Hidden Linux -->

PC World is New Zealand’s top selling computing and technology magazine.
Comments
I'm not sure about Wine but you'll find that both Cedega (www.cedega.com) and CodeWeavers (www.codeweavers.com) have commercial offerings.
Posted by: Geoff | November 11, 2009 6:49 AM
Do you know the best way to run very detailed fps games in wine? Ohh and I am now running on ubuntu thanks for telling me about the best os that i've tried out (no interuptions at start ups, no backgorund services) I have also a game that I like on ubuntu tremulous
Posted by: Sheridan McMillan | November 10, 2009 8:32 PM