2

man umount2 says:

   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.

umount doesn't seem to support it.

Are there any utilities which allow one use this flag?

  • +1. I'm curious; what should this option do? – roaima Aug 12 '17 at 12:26
2

You can easily access C functions from Python.

#!/usr/bin/env python
import os, sys
from ctypes import *
libc = CDLL('libc.so.6', use_errno=True)
MNT_EXPIRE = 4
libc.umount2(c_char_p(sys.argv[1]), c_int(MNT_EXPIRE))
if get_errno() != 0:
    print os.strerror(get_errno())
    exit(1)

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.