Run a file system check on your next boot.

sudo touch /forcefsck
The empty file /forcefsck causes the file system check fsck to be run next time you boot up, after which it will be removed. This works too: sudo >/forcefsck

38
By: johnraff
2009-10-29 17:04:47

What Others Think

Which distro are you on ? It works on redhat Fedora and RHEL, but I'm not sur for the others.
pruneau · 625 weeks and 1 day ago
Works for Debian and Ubuntu, too.
funollet · 625 weeks and 1 day ago
Great command! It's a kernel functionality or just some distro specific?
funyotros · 625 weeks ago
Seems to be a general Linux facility.
johnraff · 624 weeks and 4 days ago
No, it's not in the Linux kernel. In Debian, it's implemented in /etc/init.d/checkfs.sh and checkroot.sh with a line that looks like this if [ -f /forcefsck ] || grep -s -w -i "forcefsck" /proc/cmdline Skimming through those files, I notice that you can do the opposite (force skipping fsck) by creating the file "/fastboot" sudo touch /fastboot
hackerb9 · 621 weeks and 6 days ago
shutdown -Fr now will reboot and fsck.
karol · 574 weeks and 4 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: