How to force fsck to check filesystem after system reboot on Linux - LinuxConfig.org

Let's start with discussion about some tools which can be used to obtain filesystem information and configurations which control filesystem check after system reboot. The tool which we are going to discuss is tune2fs filesystem managing utility. Using tune2fs we can export some important information related to filesystem health check. The following linux command will tell as when was the last time the filesystem /dev/sdX was checked:


This is a companion discussion topic for the original entry at https://linuxconfig.org/how-to-force-fsck-to-check-filesystem-after-system-reboot-on-linux

AmericanPenguin

Doesn’t work. Refuses to check.

Wojciech Domalewski

Does it work with systemd ?

thecarpy -> Wojciech Domalewski

You can get it work updating your grub2 config, rebooting, and undoing the changes to your grub config, however, it is much easier to just specify “passno=1” as an option to /etc/fstab, no need to run the update-grub/update-grub twice …

Lesson of the day: Avoid repeating something somebody else writes on the internet without reading the man page first. https://www.freedesktop .org/software/systemd/man/systemd-fsck@.service.html

WI Native -> Wojciech Domalewski

Doesn’t look like it will. I got this from another site.

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:

fsck.mode=
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.

fsck.repair=
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.

Lubos Rendek Mod -> WI Native

what Linux distribution do you use? Having this answer I would be able to provide you with help.

WI Native -> Lubos Rendek

RHEL 6.4. I did get it to work using the above instructions on this page.

If the value of maximum mounts is greater or equal to total number of mounts value then fsck’s filesytem check will be performed.

I assume we mean “is less than or equal to”.

Thank you for the wonderful article!

you also may try

sudo touch /forcefsck

It will check filesystem at next boot and remove the file automatically once done