LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How can I reboot with a forced fsck upon rebooting? (https://www.linuxquestions.org/questions/linux-software-2/how-can-i-reboot-with-a-forced-fsck-upon-rebooting-401252/)

abefroman 01-09-2006 12:40 PM

How can I reboot with a forced fsck upon rebooting?
 
How can I reboot with a forced fsck upon rebooting?

PTrenholme 01-09-2006 01:54 PM

Why? You can always boot in level 3, mount the file system read-only, and run fsck by hand.

Looking at my /etc/rc.d/rc.sysinit suggests that a touch /forcefsck will cause a full fsck run next time you restart, since rc.sysinit checks for the presence of the forcefsck file in / before it runs fsck, and adds the -f option if it's found.

megaspaz 01-09-2006 03:33 PM

/sbin/reboot -f

will force fsck on next reboot.

PTrenholme 01-09-2006 08:47 PM

Quote:

Originally Posted by megaspaz
/sbin/reboot -f

will force fsck on next reboot.

Acording to man reboot,
Quote:

OPTIONS
-n Don’t sync before reboot or halt.

-w Don’t actually reboot or halt but only write the wtmp record (in the /var/log/wtmp file).

-d Don’t write the wtmp record. The -n flag implies -d.

-f Force halt or reboot, don’t call shutdown(8).

-i Shut down all network interfaces just before halt or reboot.

-h Put all harddrives on the system in standby mode just before halt or poweroff.

-p When halting the system, do a poweroff. This is the default when halt is called as poweroff.
So, if I read that correctly, -f just reboots simulating a power failure. And, yes, pulling the plug on you system and then restarting will force fsck, but skipping the shutdown processing seems just a little drastic:eek: if you can get by with running a normal reboot.

It's your choice, Abe, but let us know how you make out.

And megaspaz, thanks for the reboot suggestion -- I hadn't realized that reboot had any options.

gilead 01-09-2006 09:24 PM

Slackware 10.2 checks for /etc/forcefsck in /etc/rc.d/rc.M which is called during startup - so if you're using Slackware just touch that file and reboot...


All times are GMT -5. The time now is 07:32 PM.