Linux Force fsck on the next reboot or boot sequence
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.
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
E-mail this to a friend
Printable version
Related Other Helpful FAQs:
- Can I run fsck or e2fsck when Linux file system is mounted?
- Linux / UNIX: Getting information about reboots and shutdowns
- What command do you run to check file system consistency under UNIX or Linux?
- Boot Ubuntu Linux into Rescue mode to fix system
- Linux: How to load a kernel module automatically at boot time
Discussion on This FAQ
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: /forcefsck, change directory, configuration file, directory cd, file system check, Linux, linux file systems, linux system, run fsck, scripts




February 26th, 2007 at 8:53 pm
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)
September 24th, 2007 at 5:21 pm
nice! didn’t know that at alL!!
February 19th, 2008 at 6:39 am
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
March 12th, 2008 at 7:46 pm
shutdown -rF now <-will reboot and forcefsck now. More info: man shutdown
July 10th, 2008 at 10:05 am
@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.
August 18th, 2008 (3 weeks ago) at 8:20 pm
On RHEL 4, ’shutdown -rF’ just writes /forcefsck anyway.