Yesterday, one of our computers dropped to grub
shell or honestly, I am unsure what shell it was when we turned on the machine.
It showed that it can't mount the root filesystem or something in this sense, because of inconsistencies.
I ran, I believe:
fsck -fy /dev/sda2
Rebooted and the problem was gone.
Here comes the question part:
I already have in her root's crontab:
@reboot /home/ruzena/Development/bash/fs-check.sh
while the script contains:
#!/bin/bash
touch /forcefsck
Thinking about it, I don't know, why I created script file for such a short command, but anyways…
Further, in the file:
/etc/default/rcS
I have defined:
FSCKFIX=yes
So I don't get it. How could the situation even arise?
What should I do to force the root filesystem check (and optionally a fix) at boot?
Or are these two things the maximum, that I can do?
OS: Linux Mint 18.x Cinnamon 64-bit.
fstab
:
cat /etc/fstab | grep ext4
shows:
UUID=a121371e-eb12-43a0-a5ae-11af58ad09f4 / ext4 errors=remount-ro 0 1
grub
:
fsck.mode=force
was already added to the grub
configuration.
Best Answer
ext4
filesystem check during bootTested on OS: Linux Mint 18.x in a Virtual Machine
Basic information
/etc/fstab
has thefsck
order as the last (6th) column, for instance:FSCKFIX=yes
variable in/etc/default/rcS
This will change the fsck to auto fix, but not force a fsck check.
From
man rcS
:From
man tune2fs
Start with
Setting the following
in the file
Check and note last time fs was checked:
These two options did NOT work
Passing
-F
(forcefsck
on reboot) argument toshutdown
:Nope; see:
man shutdown
.Adding the
/forcefsck
empty file with:These scripts seem to use this:
did NOT work on reboot, but the file was deleted.
Verified by:
These seem to be the logs for the
init
scripts.I repeat, these two options did NOT work!
Both of these methods DID work
systemd-fsck kernel boot switches
Editing the main
grub
configuration file:This did do a file system check as verified with:
Note: This DID a check, but to force a fix too, you need to specify
fsck.repair="preen"
, orfsck.repair="yes"
.Using
tune2fs
to set the number of file system mounts before doing afsck
,man tune2fs
-c
switch sets the number of times to mount the fs before checking the fs.Verify with:
This DID work as verified with:
Summary
To force a
fsck
on every boot on Linux Mint 18.x, use eithertune2fs
, orfsck.mode=force
, with optionalfsck.repair=preen
/fsck.repair=yes
, the kernel command line switches.