Finding out the time a filesystem was last mounted

17,830

Solution 1

Update: well that was too easy

$ sudo tune2fs -l /dev/sda1
tune2fs 1.41.11 (14-Mar-2010)
Last mounted on:          /
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              7028736
Filesystem created:       Sat Nov 14 20:49:49 2009
Last mount time:          Wed Jun  9 18:19:42 2010
Last write time:          Thu Jun  3 09:38:18 2010
Mount count:              20
Maximum mount count:      32

and tune2fs handles ext4 partitions too, I just don't have one handy.

Solution 2

I've just found a way for NFS by reading /proc/self/mountstats (or any other PID). It gives the age in seconds:

device 1.2.3.4:/HOME mounted on /mnt/HOME with fstype nfs statvers=1.1
[...]
    age:    1047998
[...]
Share:
17,830

Related videos on Youtube

MichaelM
Author by

MichaelM

CompSci PhD. Principal Engineer @ CareApp

Updated on September 17, 2022

Comments

  • MichaelM
    MichaelM over 1 year

    I want to find out the last time a filesystem was mounted on Linux (Debian). Any help?

  • Benoît
    Benoît over 10 years
    This works only for ext* and requires root privilege. I'm looking for this answer but for anykind of FS (local, NFS, etc).