BIP KB:
How To Force fsck on the Next Reboot or Boot Sequence Linux

Article By lee


img

KB Knowledge Base  - Force fsck linux - VPS server hosting at BIPmedia.com If you want to force fsck on the next reboot? How do I force fsck on a Linux based VPS server or laptop? Is there any configuration file that I need to alter for this purpose on a Linux?

fsck command is used to check and optionally repair one or more Linux file systems. You don’t have to create or alter/modify any file. All you need to do is just create empty file called /forcefsck.


How does fsck force work at every boot on a Linux?

On a Debian or Ubuntu Linux /etc/init.d/checkfs.sh (or /etc/init/mountall.conf on a Ubuntu LTS v14.04+) is used to run fsck command if /forcefsck. On a RHEL/CentOS 6.x /etc/rc.sysinit file is used to run fsck command. If there is a /fsckoptions file, the options are loaded from the /fsckoptions file. If there is a /forcefsck file, -f is added.


Force fsck on boot using /forcefsck

By creating /forcefsck file you will force the Linux system (or rc scripts) to perform a full file system check. First, login as the root user:

$ su -

OR

$ sudo -s

Change directory to root (/) directory [optional]:

# cd /

Create a file called forcefsck:

# touch /forcefsck

Now, reboot the system:

# reboot

Force fsck on next boot using shutdown command (may not work on many modern distros) The -F option force fsck on reboot, login as root and type the following command to reboot and run fsck:

# shutdown -rF now

The above will check all the relevant partitions immediately.




Tags: , , , ,

Spin up a VPS server in no time flat

Simple setup. Full root access. Straightforward pricing.

DEPLOY VPS SERVER

Leave a Reply



Feedbacks