Where are fsck results logged at boot time, after /forcefsck?

49,542

Solution 1

Possibly you are affected by this bug: "Does not log fsck invocations in /var/log/fsck/"

Solution 2

For Ubuntu 14.xx:

I found some fsck logs in /var/log/upstart/mountall.log.

Solution 3

For Ubuntu 16.04 and 18.04 root partitions

You're likely looking for /run/initramfs/fsck.log.

An fsck of the root filesystem necessarily happens before the root filesystem has been mounted as writable, so the filesystem check occurs early in the boot process while the system is still running from the initramfs. An fsck log is written to a RAM-backed filesystem (tmpfs) that is available for writing at this time, and it continues to be available after boot at /run/initramfs/fsck.log. This is volatile storage, so fsck logs are lost once the system reboots. It would be nice if these logs were copied to non-volatile storage after the root filesystem is mounted as writable, but this does not appear to be the case.

Here's an example:

$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 238.5G  0 disk 
├─sda1   8:1    0   512M  0 part /boot/efi
└─sda2   8:2    0   238G  0 part /

$ cat /run/initramfs/fsck.log 
Log of fsck -C -a -V -t ext4 /dev/sda2 
Fri Nov 30 22:35:21 2018

fsck from util-linux 2.31.1
[/sbin/fsck.ext4 (1) -- /dev/sda2] fsck.ext4 -a -C0 /dev/sda2 
/dev/sda2: clean, 653295/15597568 files, 6658147/62383360 blocks

Fri Nov 30 22:35:21 2018
----------------

Solution 4

For Ubuntu 16.04

The command journalctl -b --no-pager | grep systemd-fsck

reports non root partition file system checks.similar to this:

Mar 22 15:06:26 64bitUbuntu systemd-fsck[750]: /dev/sdb1: clean, 146223/121454592 files, 356711795/485818368 blocks

For root partition checks at boot issue the command more /var/log/boot.log

Provides results similar to this:

/dev/sda2: clean, 349091/1954064 files, 2379983/7814912 blocks

Solution 5

For Ubuntu 18.04

The command journalctl -b --no-pager | grep systemd-fsck and grep systemd-fsck /var/log/syslog

both report non root partition file system checks.similar to this:

Sep 25 16:06:29 me-Z370-HD3P systemd-fsck[615]: Scratch: clean, 19/6520832 files, 555602/26081280 blocks
Sep 25 16:06:29 me-Z370-HD3P systemd-fsck[609]: /dev/sda1: clean, 47014/89374720 files, 294970235/357492992 blocks
Sep 25 16:06:29 me-Z370-HD3P systemd-fsck[613]: /dev/sda5: clean, 6707/32727040 files, 7464312/130885120 blocks

Checks of root partitions mounted by UUID results don't appear to be logged even if forced.

Share:
49,542
Bart Silverstrim
Author by

Bart Silverstrim

Sysadmin, Assister for Users of Technology, Writer of Words, and Flixer of Nets

Updated on September 18, 2022

Comments

  • Bart Silverstrim
    Bart Silverstrim almost 2 years

    When working remotely I set a server to force an fsck at boot time with the sudo touch /forcefsck command and rebooted.

    After it restarted I checked in /var/log/fsck for the results of the disk check.
    Both checkfs and checkroot said: Nothing has been logged yet

    So where is it saving the results?

    • Admin
      Admin over 11 years
      Having the same problem on Ubuntu 12.04 LTS. I found the fsck log in /var/log/boot.log.
  • Bart Silverstrim
    Bart Silverstrim about 12 years
    Most likely. Shouldn't be surprised anymore that it's probably not going to be addressed...
  • tamale
    tamale over 10 years
    This affects us in a very negative manner as well - we're on EC2 and when servers reboot we need details of things like this. How can this possibly be considered a 'wishlist' item? This is core functionality, and it's broken.
  • Fabby
    Fabby over 9 years
    Welcome to Ask Ubuntu. ;-) There used to be a bug in 11.10 at the time, so your answer on a new system right now doesn't add any value to this 3 year old question. For the future: look at a question's date and whether there already is an answer. ;-)
  • NGRhodes
    NGRhodes over 9 years
    I've added a tag to help search engines show this as an old question.
  • syntaxerror
    syntaxerror almost 9 years
    @tamale You're fully right. I got hit by this too. My / partition had a nasty quirk, and when entering recovery mode, it forced an e2fsck on it. This is perfect, but as it's really hard to remember which files to replace from backup, one must be able to track down the file names reportedly corrupt.
  • syntaxerror
    syntaxerror almost 9 years
    @Byte Commander This supposedly "old" question helped me a LOT indeed! I would never have guessed that fsck logs would be hidden away in /var/log/upstart/mountall.log resp. /var/log/upstart/mountall.*.log.gz. Fairly illogical. HOWEVER, it seems that the file names reported to be corrupt were not logged, just their inodes.
  • Organic Marble
    Organic Marble about 8 years
    Helped me as well.
  • Jonah Braun
    Jonah Braun over 5 years
    For root partitions, this appears to be the only correct answer for 16.04 + systemd.
  • laviex
    laviex almost 4 years
    fyi, time logged is UTC time.
  • xCovelus
    xCovelus over 3 years
    very nice, thank you, and I confirm it also works in 20.04 LTS