1

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?

  • Hi! I love this question. It seems the answer depends a bit e.g. on what initramfs generator you use (on whether the initramfs uses systemd or not). Since you have given a specific example in your question, could you please specify exactly what OS and version it comes from. Preferably also the version number of your systemd package. And, while I am asking, are you using a specific initramfs generator, or just using the default initramfs that your distribution installed? – sourcejedi Jan 12 at 15:27
4

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.

  • I did try journalctl but realized that it was deconfigured NOT to log from syslog. However, syslog does show the console "clean" message. – awoz Apr 6 '18 at 17:55
  • Regarding systemctl, it only shows the the status of the systemd-fsck service, and its exit code. – awoz Apr 6 '18 at 17:57
  • Github for systemd-fsck also indicates that all fsck "progress" goes to /dev/console, with several unique exits codes. – awoz Apr 6 '18 at 18:00
  • The solution looks like a combination of journal and syslog scrubbing operations. No standard API for status :( – awoz Apr 6 '18 at 18:02
  • 1
    @awoz - fsck at boot time is run from initramfs so there's no filesystem to write to, though some distros work around that and save the output to /run/initramfs/* or /var/log/fsck/* – don_crissti Apr 6 '18 at 18:28
1

I can confirm don_crissti response above.

For my Beaglebone running Debian 8.3 (Jessie), the result is in /run/initramfs/fsck.log

I have fsck.mode=force and fsck.repair=yes set in /boot/uEnv.txt for Kernel command line options

root@beaglebone:~# more /run/initramfs/fsck.log
Log of fsck -C -f -y -V -t ext4 /dev/mmcblk0p1
Thu Jun 28 13:52:24 2018
fsck from util-linux 2.25.2
[/sbin/fsck.ext4 (1) -- /dev/mmcblk0p1] 
fsck.ext4 -f -y -C0 /dev/mmcblk0p1
e2fsck 1.42.12 (29-Aug-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
BOOT: 38273/240000 files (0.1% non-contiguous), 284298/958208 blocks

root@beaglebone:~# cat /etc/dogtag
BeagleBoard.org Debian Image 2016-02-15

root@beaglebone:~# more /etc/debian_version
8.3

root@beaglebone:~# uname -a
Linux beaglebone 4.1.17-ti-rt-r48 #1 SMP PREEMPT RT Fri Feb 12 23:46:00 UTC 2016 armv7l GNU/Linux

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.