How to responsibly avoid "fsck forced"?

Moritz von Schweinitz asked:

So I just swapped out a RAID HDD on a server. I got the “hasn’t been checked for X days, fsck forced” message, and am patiently waiting right now.

This got me wondering: how can I responsibly avoid this situation? I know that I could skip the forced fsck, and that I can’t really do a real fsck while the system is running.

So is there a way to do an online fsck on a server in the night, just to check if there are any potential problems? And if there aren’t, make the system NOT running the forced fsck?

Would an online read-only fsck detect (not fix) the same problems a full-blown fsck would?

This is one ext3.

My answer:

Switch to a more modern journaled filesystem such as XFS or ext4. In these systems a full fsck isn’t necessary if the filesystem is unclean; the journal is just replayed, which takes a second or so. Even if a full fsck is forced, ext4 is significantly faster at fsck than ext3.

You’re going to need a Linux system from the last several years that supports ext4. In particular, kernel version 2.6.24 or higher. It sounds like your system is pretty ancient, so it might not even have support for ext4. If that’s the case, it’s almost certainly far past end of life anyway…

(Note: While ext3 is journaled it is missing several optimizations present in ext4 which cause fsck to run much faster.)

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.