How to Force a Filesystem Check on a Linux Root Partition (fsck)
This tutorial explains why you cannot run fsck on a mounted root filesystem, shows how to inspect the last check with tune2fs, and provides a step‑by‑step method using a /forcefsck file to force a root filesystem check on the next reboot.
Root Filesystem
In this example the /dev/sda1 partition is mounted as the root filesystem ( /).
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 63G 41G 19G 69% /Running fsck /dev/sda1 on a mounted root filesystem produces an error because the device is in use.
# fsck /dev/sda1
fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
/dev/sda1 is mounted.
e2fsck: Cannot continue, aborting.For non‑root filesystems you can simply unmount the partition and run fsck, but the root filesystem requires a different approach.
Tune2fs Output Before Reboot
Before forcing a check, examine when the root filesystem was last checked using tune2fs and grep for the word “check”.
# tune2fs -l /dev/sda1 | grep -i check
Last checked: Mon Nov 24 12:39:44 2015
Check interval: 15552000 (6 months)
Next check after: Sun May 22 13:39:44 2016Last checked – the timestamp of the most recent fsck on the root filesystem.
Check interval – how often the filesystem is scheduled for a check (here, every six months).
Next check after – the future date when the next automatic check will occur.
We want to run a check immediately rather than waiting until May.
Create /forcefsck File to Force Check
To force a check on the next reboot, create an empty file named forcefsck in the root directory.
# cd /
# touch forcefsck
# ls -l /forcefsck
-rw-r--r-- 1 root root 0 Mar 9 20:15 /forcefsckThen reboot the system.
# rebootTune2fs Output After Reboot
After the reboot, the system runs fsck on the root filesystem and automatically removes the /forcefsck file.
# ls -l /forcefsck
ls: cannot access /forcefsck: No such file or directoryRunning tune2fs again shows the updated timestamps.
# tune2fs -l /dev/sda1 | grep -i check
Last checked: Wed Mar 09 20:30:04 2016
Check interval: 15552000 (6 months)
Next check after: Mon Sep 05 21:30:04 2016The “Last checked” field now reflects the recent reboot, confirming that the forced filesystem check was performed.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
