24

What command can tell me the last time that a filesystem was fsck'd? A date would be nice, but I'd settle for the mount count since the last fsck.

I've looked all around for this in fsck*, lsattr, and stat, and I don't see it.

Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47

5 Answers5

22

tune2fs -l gives you that information for ex.

sudo tune2fs -l /dev/sda1 | grep "Last checked"

pragnesh
  • 492
  • 2
  • 5
9

You can use tune2fs to get the information

tune2fs -l /dev/devicetocheck | grep "Last Checked"

Similarly you can get the mount count

tune2fs -l /dev/devicetocheck | grep "Mount Count"
user9517
  • 115,471
  • 20
  • 215
  • 297
  • For Debian Jessie (tune2fl version 1.42.12), the correct `grep` argument for the second command listed above is `"Mount count"` – Digger Sep 05 '20 at 18:11
7

Apart from tune2fs -l, dumpe2fs will also give you this information:

dumpe2fs /dev/sda1 | grep "Last Checked"
dumpe2fs /dev/sda1 | grep "Mount Count"
etagenklo
  • 5,834
  • 1
  • 27
  • 32
6

Thanks everyone! And for reiserfs I found that debugreiserfs shows the mount count and last fsck run date.

Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47
0

if one uses lvm

tune2fs -l /dev/sda5 | egrep -i "mount count|Check interval|Last|Next"

will fail with:

tune2fs: Bad magic number in super-block while trying to open /dev/sda5

one will have to do like this:

tune2fs -l /dev/hostname-vg/root | egrep -i "mount count|Check interval|Last|Next"
Last mounted on:          /
Last mount time:          Wed Sep  4 17:45:12 2019
Last write time:          Wed Sep  4 17:45:10 2019
Mount count:              20
Maximum mount count:      -1
Last checked:             Fri Aug 30 16:09:19 2019
Check interval:           0 (<none>)
canoodle
  • 193
  • 1
  • 4