0

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?

1
  • Not quite correct. This option is only valid for autoFS filesystems that are mounted on request and unmounted after a certain period of inactivity. It does not apply to regular filesystems. Commented Jun 18, 2021 at 7:23

1 Answer 1

2

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.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.