From umount(2):

MNT_EXPIRE (since Linux 2.6.8)

Mark the mount point as expired. If a mount point is not currently in use, then an initial call to umount2() with this flag fails with the error EAGAIN, but marks the mount point as expired. The mount point remains expired as long as it isn't accessed by any process. A second umount2() call specifying MNT_EXPIRE unmounts an expired mount point. This flag cannot be specified with either MNT_FORCE or MNT_DETACH.

What is the use-case for MNT_EXPIRE? How is it useful?

What is different about an "expired" mount point?



It is used to unmount a filesystem after a period of inactivity.

Systemd automount units implement such a feature, for example.

  • 1
    Interesting. I imagine then that a daemon would simply call umount(MNT_EXPIRE) periodically, and if no process had accessed the mount in the last period it would be unmounted. – Jonathon Reinhart Jan 8 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.