OS is CentOS 5.

Generally after an unclean shutdown, the CentOS startup text will display something about a fsck being needed due to an unclean shutdown. (I can't remember the exact text off the top of my head)

Also, if you go a certain number of days without a fsck, the message "check forced" will be displayed, and the machine will fsck.

But what if BOTH items are true? The machine had an unclean shutdown AND it has gone 1000 days without a fsck, which message gets printed during startup?

Why do I need to know? I need to know if it is safe to skip a fsck. This situation doesn't occur often, but it does come up. Of course they should have used xfs, of course things should be redundant, but this is real life. Sometimes you encounter the scenario where the fsck will take 10 hours and every minute of that is downtime. (Personally I would say never skip a fsck but that's not my call to make)


According to e2fsck/unix.c in the e2fsprogs sources (trimmed to important bits)

if ((fs->super->s_state & EXT2_ERROR_FS) || !ext2fs_test_valid(fs))
    reason = _(" contains a file system with errors");
else if ((fs->super->s_state & EXT2_VALID_FS) == 0)
    reason = _(" was not cleanly unmounted");
else if (check_backup_super_block(ctx))
    reason = _(" primary superblock features different from backup");
else if ((fs->super->s_max_mnt_count > 0) ...
    reason = _(" has been mounted %u times without being checked");
else if (!broken_system_clock && fs->super->s_checkinterval ...
    reason = _(" has filesystem last checked time in the future");
else if (!broken_system_clock && fs->super->s_checkinterval ...
    reason = _(" has gone %u days without being checked");

As you can see, it's a list of if/else if conditions. They'll check from top to bottom and only display the first reason found.

You can rest assure that a unclean filesystem will be indicated as such

| improve this answer | |
  • Above and beyond the call of duty in answering the question. I applaud you, sir. – Scrivener Jan 23 '13 at 4:09

If you're really stuck, I'd recommend booting to rescue mode from a CD/DVD, run "tune2fs -i 0 -c 0" on the filesystem, and reboot. That way, if the filesystem is clean, it will just mount. If it's dirty, it will go through the fsck.

| improve this answer | |
  • 1
    BTW, you can disable the timed FSCKs with the tune2fs command as given above....however you can do this even if the system is up and mounted. On nearly all my servers I have disabled these timed fscks because I find that usually they hinder recovery from an important crash situation. I let the system decide (based on the dirty bit) if there should be a full fsck or not. – mdpc Jan 22 '13 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.