Linux Force fsck on the Next Reboot or Boot Sequence

I want to force fsck on the next reboot? How do I force fsck on a Linux based 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.[donotprint]
Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements None
Est. reading time 1m

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

On a Debian or Ubuntu Linux /etc/init.d/ (or /etc/init/mountall.conf on a Ubuntu LTS v14.04+) is used to run fsck command if /forcefsck.

Check the /etc/init/mountall.conf file, for example the file from Ubuntu 14.04 LTS

    . /etc/default/rcS || true
    [ -f /forcefsck ] && force_fsck="--force-fsck"
    [ "$FSCKFIX" = "yes" ] && fsck_fix="--fsck-fix"
    # Doesn not work so well if mountall is responsible for mounting /proc, heh.
    if [ -e /proc/cmdline ]; then
        read line < /proc/cmdline
        for arg in $line; do
            case $arg in
        done < /proc/cmdline
    # set $LANG so that messages appearing in plymouth are translated
    if [ -r /etc/default/locale ]; then
        . /etc/default/locale || true
    exec mountall --daemon $force_fsck $fsck_fix $debug_arg

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.

Check the /etc/rc.sysinit file, for example the file from RHEL/CentOS Linux 6.x

Fig.01: RHEL/CentOS 6.x /etc/rc.sysinit file,

Fig.01: RHEL/CentOS 6.x /etc/rc.sysinit file,

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 -
$ sudo -s
Change directory to root (/) directory [optional]:
# cd /
Create a file called forcefsck:
# touch /forcefsck
Now, reboot the system:
# reboot

Frce 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.

A note about systemd based systems

The above mentioned solution only works with the old SysVinit and early versions of Upstart. It won’t work with systemd. systemd-fsck understands one kernel command line parameter:

One of “auto”, “force”, “skip”. Controls the mode of operation. The default is “auto”, and ensures that file system checks are done when the file system checker deems them necessary. “force” unconditionally results in full file system checks. “skip” skips any file system checks.
One of “preen”, “yes”, “no”. Controls the mode of operation. The default is ” preen”, and will automatically repair problems that can be safely fixed. “yes ” will answer yes to all questions by fsck and “no” will answer no to all questions.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 31 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
31 comments… add one
  • Tom Feb 26, 2007 @ 20:53

    Good info. You don’t need to goto the root directory if you’re providing the full path, as you are. You can:
    touch /forcefsck
    from anywhere… You do need to cd / if you are using a relative path, such as
    cd /
    touch forcefsck
    cd /
    touch ./forcefsk
    but not
    cd ~
    touch ../forcefsk
    (changes to /root, and creates the file one directory level higher)

  • Ifan Sep 24, 2007 @ 17:21

    nice! didn’t know that at alL!!

  • sudar Feb 19, 2008 @ 6:39

    Hi every one,
    I’m able to reboot my target board using the command [reboot] from the bash prompt.
    But i can able to by the command [reboot -f].
    What should i need to do if i want to use the command [reboot]
    Plz help me.
    Thanks in Advance

  • dj Mar 12, 2008 @ 19:46

    shutdown -rF now <-will reboot and forcefsck now. More info: man shutdown

  • Martijn Jul 10, 2008 @ 10:05


    Your ‘shutdown’ tip won’t work on many modern distributions, since they use Upstart instead of the old Sysvinit system.

    Upstart has dropped many legacy commands that would be better done differently, in favor of a modern lean system.

    ‘touch /forcefsck’ is currently the most universal way.

  • Jason B Aug 18, 2008 @ 20:20

    On RHEL 4, ‘shutdown -rF’ just writes /forcefsck anyway.

  • Nigel Horne Feb 4, 2009 @ 16:53

    There’s no need to use the touch command, “>/forcefsck” will do.

  • yanger Feb 27, 2009 @ 0:42

    thanks! sudo touch /forcefsck is a good way :)

  • ankur May 16, 2009 @ 16:05

    What about trying to force fsck another partition ?

  • neurosys Jun 26, 2009 @ 9:40

    then u could just umount it……

  • neurosys Jun 26, 2009 @ 9:41

    umount /dev/hdb2; fsck -y -c -f /dev/hdb2;echo ‘w00t’

    • Paolo Jul 6, 2011 @ 15:04

      Thanks, this works great for me!

  • like how? Aug 7, 2009 @ 20:29

    me@mybox:/$ sudo umount /dev/hdb2
    umount: /home: device is busy.
    me@mybox:/$ echo ‘unwoot’

  • Axel Werner Sep 1, 2009 @ 13:16

    Will performing a “shutdown -rF now” or a “touch /forcefsck ” at a specific date and time once a week prevent the “automatic fsck” that is forced by the ext2/ext3 partition parameters ?? (can be set by tune2fs ) – i mean.. will it “reset” the timeouts/deadlines if doing a force fsck manualy once a week so there will be no “surprise” when trying to reboot my server if needed ?? any positive experience on that?

  • itpatil Dec 11, 2009 @ 10:11

    Hey, thanks for the information. Appreciate it.

  • David Nuttall Feb 8, 2010 @ 18:21

    Running fsck, by whatever means, will cause the mount counter to be reset to 0. Well, so long as it completes successfully. If fsck dies for some reason (like trying to run on a mounted or read-only file system, oops) then the counter is not reset.

    As for running on fsck on the partition mounted on /home, that should automagically mount, and will be checked at that time; just do (no quotes) “sudo touch /home/forcefsck” if mounted and if not mounted, you can run it directly, if you can log in, that is. Get to root and just run it one the device: “sudo fsck /dev/sda6” or whatever device it is.

  • Light Feb 24, 2010 @ 7:43

    Hi ,
    I am going to check your tip hoping that ,this will work on My Ubuntu Karmic System with Ext4 File System.

  • Light Feb 24, 2010 @ 7:47

    And Yes ,it Worked with Ext4 FS.Thanks for the Tip!

  • Juraj Jul 6, 2010 @ 18:14

    I used “touch /forcefsck” which forced the system to check after reboot…fine
    but on the subsequent boots still forces to check. I looked in root dir for the forcefsck file but it is not there….what then makes the system force to check? :(

  • xe Mar 15, 2011 @ 15:44

    How to specify some fsck cli params in this case?

  • Aj Apr 10, 2011 @ 8:01

    as root, do the following

    # (mount partition as read only – allows fsck to work)

    mount -oremount,ro /

    e2fsck /dev/sda1

    where / is the path to device you want to fsck, and sda1 is the device name (could be hda1, hda2, sdb3 etc)

    then when done, do

    mount -oremount,rw /

    (here it will give you a number which is current run level, note it (debian is N 2)


    telinit 1; telinit 2

    (where 2 is the number given to you in first telinit line)

    This b

  • Jörgen Persson Jul 4, 2012 @ 19:56

    Don’t forget to put a ‘y’ in the forcefsck file if you want to scan a remote drive. If not the check will be stuck while waiting for you to answer ‘y’, but you won’t be able to see that question…

    sudo -i
    touch /forcefsck
    echo y > forcefsck
  • Pascal Sep 22, 2012 @ 7:56

    On Fedora 17 the -F option is not available for command shutdown.

  • Manazar Oct 14, 2012 @ 3:50

    can we do this on specific filesystem ?
    Note : updated fstab fields as 0 2 ,still server skip fsck on …..

  • Neutron68 Nov 13, 2012 @ 1:49

    I followed the directions and it worked for my Mythbuntu system…on EVERY reboot.
    I found I had to remove the /forcefsck file from my hard drive, when I wanted the disk checks at reboot to stop.
    BUT, I could not see the /forcefsck file in the / directory until I did an “ls -a”

    Best wishes!

  • Eduardo Nunes Dec 3, 2012 @ 23:28

    You could also use tune2fs and set the filesystem mount count to something higher than the limit which triggers the filesystem check. This is very useful to check other filesystems besides the root /

    # tune2fs -l /dev/sda1
    and you can see on the output:
    Mount count: 3
    Maximum mount count: 38

    so you have to place the Mount count higher than 38 with the following command:
    # tune2fs -C 39 /dev/sda1

    check the value changed with tune2fs -l and then reboot!

    On my servers I like to set the filesystem Maximum mount count to 1, because when the server ever gets shutdown some shit did happen! So we must check everything!!

  • Jim Jun 21, 2013 @ 21:21

    Use “sudo chattr +i /forcefsck” without the quotes if you want to perform a filesystem check every time the Raspberry PI boots, I do just to check for problems with the SD card. The +i makes the file forcefsck immutable so it doesn’t get removed even after a reboot. I found the file disappeared after every reboot but this fixed that problem.
    Hope this stops someone else wondering where the file goes and how stop it happening.

  • Patrick Oct 9, 2013 @ 22:47

    Is there a way of setting this up to automatically repair any issues that it finds? Also, in the comment about adding a “y” to the file to scan remote drives, does that mean networked drives (located on another computer) or does it mean other drives in the same computer?

    I have two internal hard drives, and four USB (External) drives attached to a server, and I want (need?) to fsck at least one or two of the external drives–but I want to do all of the drives.

  • Balaji P Jan 27, 2014 @ 18:50

    In our environment some of the servers Filesystem automatically mount in readonly mode on the fly, we fixed it by running forefsck at reboot. may i know what will cause this kind of issue??

  • matt Nov 22, 2017 @ 12:52

    this is really overly simplistic. How do I force fsck on all my drives? This is only about the boot drive.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum