Mount traps are core elements of the implementation of autofs in Linux, and "any directory provided by a filesystem can be designated as a trap" (per autofs4.txt); from kernel space, one'd check if "a dentry has the DCACHE_NEED_AUTOMOUNT flag set, or if the inode has S_AUTOMOUNT set"; what can be done from userspace?

(Related, but not the same, question is How can I see automount points in Linux?).

  • what are you trying to accomplish here ? A cut and paste from a man page or lookalike, doesn't provide much insight to your problem. – MelBurslan Feb 20 '16 at 19:09
  • I need to create a home directory, but its parent may be managed by automounter. – sendmoreinfo Feb 21 '16 at 8:36
  • so, you should not worry about the automounter or not on the parent directory level. If the automounter is set up properly, whenever you login and set your PWD to your home directory, automounter will mount the parent. If the parent directory is not managed by automounter, you have nothing to worry about.I am unable to see a question here. – MelBurslan Feb 21 '16 at 9:33
  • ... to create a home directory before the user logs in for the first time; automounter will not be able to mount it since it does not yet exist. Sorry, should have known this will turn out a XY problem. – sendmoreinfo Feb 21 '16 at 12:14
  • is there something preventing you from mounting the automounter directory and create the user's home, at the time of user creation ? – MelBurslan Feb 21 '16 at 17:30

Apparently on Linux, Device ID (as returned by stat syscall) for the mount trap would have major number 0; minor number is not fixed and so far I have not found a way to map it to a filesystem type.

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.