Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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)

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

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

share|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
    
Awesome, thank you! :) –  cat pants Feb 5 '13 at 1:37
add comment

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.

share|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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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