Q. I want to force fsck on the next reboot? How do I force fsck? Is there any configuration file that I need to alter for this purpose.
A. fsck 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 /forcefsck.
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.
Login as the root:
$ su -
Change directory to root (/) directory:
# cd /
Create a file called forcefsck:
# touch /forcefsck
Now reboot the system:
# reboot
Frce fsck on next boot using shutdown command
The -F option force fsck on reboot, login as root and type the following command to reboot and run fsck:
# shutdown -rF now
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- My 10 UNIX Command Line Mistakes
- Linux: 20 Iptables Examples For New SysAdmins

- 25 PHP Security Best Practices For Sys Admins
- The Novice Guide To Buying A Linux Laptop
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
Facebook it - Tweet it - Print it -


{ 21 comments… read them below or add one }
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
or
cd /
touch ./forcefsk
but not
cd ~
touch ../forcefsk
(changes to /root, and creates the file one directory level higher)
nice! didn’t know that at alL!!
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
shutdown -rF now <-will reboot and forcefsck now. More info: man shutdown
@dj:
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.
On RHEL 4, ‘shutdown -rF’ just writes /forcefsck anyway.
There’s no need to use the touch command, “>/forcefsck” will do.
thanks! sudo touch /forcefsck is a good way :)
What about trying to force fsck another partition ?
then u could just umount it……
umount /dev/hdb2; fsck -y -c -f /dev/hdb2;echo ‘w00t’
Thanks, this works great for me!
me@mybox:/$ sudo umount /dev/hdb2
umount: /home: device is busy.
me@mybox:/$ echo ‘unwoot’
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?
Hey, thanks for the information. Appreciate it.
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.
Hi ,
I am going to check your tip hoping that ,this will work on My Ubuntu Karmic System with Ext4 File System.
And Yes ,it Worked with Ext4 FS.Thanks for the Tip!
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? :(
How to specify some fsck cli params in this case?
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 /
telinit
(here it will give you a number which is current run level, note it (debian is N 2)
then.
telinit 1; telinit 2
(where 2 is the number given to you in first telinit line)
This b