April 01, 2008

Killing `fsck` on boot

Being a laptop Linux user, I turn my box off more than the average user (or, more accurately, it hangs coming out of suspend so I have to reboot)... the result is that my laptop decides to `fsck` the drives after so many reboots. This really really sucks because invariably it happens at the least opportune time. I've been raging about this, privately, for quite some time and today finally decided to do something about it. Enter `tune2fs`.

`tune2fs` is a utility that allows you to tune the file system parameters of ext2 and ext3 file-systems. There are two switches of particular import: -c and -i. -c controls how many mounts the volume can go through before having to go through a `fsck`, while -i controls how long between `fsck` intervals (in days, weeks, months, etc.)

From my experience, I know its a bad idea to disable `fsck` altogether on account of the slight yet horrible possibility that you could end-up with file-system corruption. That said, I also don't want it to happen except with the rarest of frequencies. SO, I disabled the mount counter and set the `fsck` interval to 3 months. I figure I can handle a reality in which I have to sit through a full-fledged `fsck` of my disks four times a year. Here's the actual command and its output.

cjsteele@vengence:~$ sudo tune2fs -c -1 -i 3m /dev/sda1
tune2fs 1.40.2 (12-Jul-2007)
Setting maximal mount count to -1
Setting interval between checks to 7776000 second
cjsteele@vengence:~$

2 comments:

Fr. Andrew said...

fsck???

I don't know what that is, but I'm glad I haven't seen it!

C.J. Steele said...

`fsck` is the "File System CheKer`, its a *nix utility that makes sure the world is right and happy on your computer's file-system... it helps prevent/correct evil things like dangling inodes, incorrect ctimes, and bad superblocks.

...I'm sure that cleared it right-up.