Do systemd-fsck or fsck generate a status report

fscksystemd

How does one determine whether fsck operations were performed at bootup. I understand the default fsck config and behaviour, but is there a report or status that shows whether any fsck issues were found or repair operations were performed?

My system console does show a "clean" message but dmesg does not:

...
[  OK  ] Started Create Static Device Nodes in /dev.
         Starting udev Kernel Device Manager...
[  OK  ] Started udev Kernel Device Manager.
         Starting Copy rules generated while the root was ro...
[  OK  ] Started Copy rules generated while the root was ro.
[    6.346472] systemd-fsck[171]: ROOTFS-A: clean, 26178/78240 files, 107613/312576 blocks
...

Perhaps there a standard API to query fsck operations and status, rather than looking at log files?

Best Answer

You are looking for the systemd journal. man journalctl can be your entry point. To review the logs for systemd-fsck you can look at:

journalctl -u systemd-fsck*

As you'll see in man journalctl, there are are also machine-friendly output options like JSON. That's as close as you are going to come to an API to query fsck status, besides the other systemd tool for querying service status:

systemctl status systemd-fsck*

As you'll see in man systemctl, it also offers machine-friendly output formats as well.

I'm aware of no way to query fsck status without systemd.

Related Question