Force filesystem check after improper shutdown?
Hey all,
I'm curious to know if there is a way to get Linux (Fedora for the most part) to check the filesystem by default after an improper shutdown. Normally, it will prompt the user to hit Y within 5 seconds of asking to do it. If Y isn't hit, it continues on booting normally. We have a lot of systems running unattended, and I'd like to find out if there is a way to force it to run that check if for whatever reason one of those systems goes down. Is there a way or an option I can enable to make this work? Thanks. |
I'm guessing you could add this to /etc/rc.d/rc file
Code:
touch /forcefsck |
Thought I'd throw this out there as well... I think I've found the part of the rc.sysinit script that checks the FS on bootup and determines if the check needs to be run. Not being a programmer though, I don't know what I would need to change. I'm hoping someone can look at this and tell me how to get it to check by default.. it looks like the option is even in there. I just don't know how to get it. Here's the code I found:
Quote:
I apologize.. the formatting wasn't saved when I posted it. |
Hi Phaethar,
this is what we did here in order to force the integrity scan. We added the following line,(don't add the stars or arrows). if [ -f /forcefsck ] || strstr "$cmdline" forcefsck ; then fsckoptions="-f $fsckoptions" elif [ -f /.autofsck ]; then if [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --ping ; then chvt 1 fi echo $"Your system appears to have shut down uncleanly" AUTOFSCK_TIMEOUT=5 [ -f /etc/sysconfig/autofsck ] && . /etc/sysconfig/autofsck AUTOFSCK_DEF_CHECK="yes" *****************<<<<<< if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then AUTOFSCK_OPT=-f fi In a nutshell this pretty much tells the script that the input was yes. We did this on Trustix 2.1 Horizon and it works flawlessly. We tried the following which also seemed to work fine,but I'm not a fan of leaving things blank and not knowing for sure why it worked Instead of adding the new line, I removed the yes from in between the quote marks. Just leave it blank. if [ "$AUTOFSCK_DEF_CHECK" = " " ]; then ******<<<<<<<< Hope these help. |
Hi gimbeault,
Thanks a bunch for the tip, that's a nice and easy way to get it working, and it seems to be working great for Fedora as well now. Thanks! :D |
Here's a cleaner way to do it w/o modifying the rc.sysinit script:
Code:
echo "AUTOFSCK_TIMEOUT=5" > /etc/sysconfig/autofsck HTH! |
Quote:
Actually, I just entered touch /forcefsck from a console after I su'ed in as root, then rebooted. It did a filesystem check on reboot, which I needed to do to clear an earlier problem. |
All times are GMT -5. The time now is 03:58 PM. |