How to enforce boot time file system check?

That would be systemctl enable systemd-fsck-root.service. :wink:

If you start a service without enabling it and reboot, the service will not start on it’s own.

@Yochanan Thanks. Updated the post.

Thank you, this worked for me!

1 Like

Let me check… thank you to provide it

1 Like

Looks like this is interesting as well: Systemd-fsck's contradiction: should I be worried?

With the configuration information provided here How to enforce boot time file system check?, I get my root filesystem checked. However, there is another disk in the system that does not appear to be checked.

Here is my /etc/fstab:

UUID=345b76c0-f339-4ca7-8582-440f229512a1 /              ext4    defaults,noatime,nodiratime 0 1
UUID=3acbe656-9d3d-4de3-926c-a839bb0e94b2 /home          ext4    defaults,noatime,nodiratime 0 2
UUID=a9353f2a-2cf9-4d4e-ada9-f72d8602045e none           swap    defaults 0 0 

This is the output of journalctl -u systemd-fsck*:

-- Boot 7181084dd29542b8807cf15cbfc04b06 --
Jan 11 17:01:04 manjaro systemd[1]: Starting File System Check on /dev/disk/by-uuid/345b76c0-f339-4ca7-8582-440f229512a1...
Jan 11 17:01:04 manjaro systemd-fsck[178]: /dev/sda1: clean, 1325356/28745728 files, 29920520/114959872 blocks
Jan 11 17:01:04 manjaro systemd[1]: Finished File System Check on /dev/disk/by-uuid/345b76c0-f339-4ca7-8582-440f229512a1.

So it looks like the second disk is never checked.

man systemd-fsck@.service

Does not seem to help. As you can see from my /etc/fstab, passno is set to greater than zero as described in the man page:

UUID=345b76c0-f339-4ca7-8582-440f229512a1 /              ext4    defaults,noatime,nodiratime 0 1
UUID=3acbe656-9d3d-4de3-926c-a839bb0e94b2 /home          ext4    defaults,noatime,nodiratime 0 2
UUID=a9353f2a-2cf9-4d4e-ada9-f72d8602045e none           swap    defaults 0 0 

Nevertheless, only the root filesystem on 345b76c0-f339-4ca7-8582-440f229512a1 is checked.

Even with fsck.mode=force set in the kernel options, I only get the root filesystem checked. Is there no way to have other attached filesystems checked as well?
Did I overlook something? Please let me know.

There is something else I noticed:

This renders the mount options for the root filesystem to appear twice in the kernel command line:

cat /proc/cmdline BOOT_IMAGE=/boot/vmlinuz-5.10-x86_64 root=UUID=345b76c0-f339-4ca7-8582-440f229512a1 ro quiet acpi_enforce_resources=lax "acpi_osi=Windows 2009" loglevel=3 root=UUID=345b76c0-f339-4ca7-8582-440f229512a1 ro resume=UUID=a9353f2a-2cf9-4d4e-ada9-f72d8602045e vga=off nvidia-drm.modeset=1

This looks good as far as I can tell:

systemctl status systemd-fsck@* ● systemd-fsck@dev-disk-by\x2duuid-3acbe656\x2d9d3d\x2d4de3\x2d926c\x2da839bb0e94b2.service - File System Check on /dev/disk/by-uu> Loaded: loaded (/etc/systemd/system/systemd-fsck@.service; static) Active: active (exited) since Tue 2021-01-12 16:52:10 CET; 2h 46min ago Docs: man:systemd-fsck@.service(8) Process: 237 ExecStart=/usr/lib/systemd/systemd-fsck /dev/disk/by-uuid/3acbe656-9d3d-4de3-926c-a839bb0e94b2 (code=exited, stat> Main PID: 237 (code=exited, status=0/SUCCESS)

I checked, it’s there.

Here, only my root filesystem on /dev/sda1 appears:

-- Boot 9014e54e0e4d466d93a1430ae19df252 -- Jan 12 15:37:51 manjaro systemd-fsck[181]: /dev/sda1: clean, 1325399/28745728 files, 29948663/114959872 blocks -- Boot 132050fd8efe4cb793541f5e7cf9e82d -- Jan 12 16:52:09 manjaro systemd-fsck[181]: /dev/sda1: clean, 1325397/28745728 files, 29948665/114959872 blocks - that’s just why I was asking.
UPDATE: I just saw that Maximum mount count was set to -1 meaning that this filesystem is never checked. I now set it to be checked at least after a certain interval using tune2fs /dev/sdb1 -i 1m.

Interestingly, in my /etc/default/grub, there is the following comment:

# Ensure that the root filesystem is mounted read-only so that systemd-fsck
# can run the check. This requires that /etc/grub.d/11_linux_root_fs is
# installed and enabled. 
GRUB_ROOT_FS_RO=true

There is no file /etc/grub.d/11_linux_root_fs on my system. Does this comment refer to that previous hack from How to enforce boot time file system check? - #24 by 10101000 ?