
When you mount a filesystem with mount
, the OS apparently keeps track of how long it's been idle since the systemd option TimeoutIdleSec
responds to it.
If I want to find out how long a particular mount has been idle, and print it to the console for example, how can I do that?
Antwort1
I don't use autofs, but the doc (https://www.kernel.org/doc/html/latest/filesystems/autofs.html) states that you can do an ioctl
on the root directory of the autofs filesystem:
AUTOFS_IOC_SETTIMEOUT: This passes a pointer to an unsigned long. The value is used to set the timeout for expiry, and the current timeout value is stored back through the pointer.
So, it seems that it is not so much systemd that reads the time-out, but it is a feature of autofs.
For regular file systems, there is no such option. You could take the read counters in /proc/diskstats
on a regular basis and if they haven't changed for a while.