Linux – How todentify automount mount path

aixautofsautomountlinuxmacos

I need to know all the mount points monitored by autofs/automount.

I came across "automount -m" to dumpmaps and "/etc/init.d/autofs status" in the older versions. But these commands doesn't work across all the automount versions and not available in all the platforms like Linux, AIX, MAC.

So is there any way to get this details without parsing auto.master/auto_master.

Best Answer

I scanned through the change logs for autofs and saw nothing to indicate that the 'dump maps' / automount -m command was or will be deprecated, so it should pretty much universally work.

It does require root to run; possibly that was an issue? If it is absolutely not working on a particular PC, please provide the version (automount -V) and the OS Type and full version.

You can get the same information - the list of all possible mounts - the way that you said you didn't want to: cat /etc/auto.master That will provide a rolled up list of monitored spots. To get just the mountpoints (no comments or extraneous info) use grep -vE "^[+#]" /etc/auto.master To make this painless, set an alias (bash syntax) alias autoMaps='grep -vE "^[+#]" /etc/auto.master and you'll save yourself the hassled of parsing the output (it strips out everything but the mounts).

This approach would be reasonable (in my opinion) for a straightforward autofs configuration. A complex system with LDAP, multiple master mount points and dozens of other configuration possibilities would make it far less serviceable.

df -a -t autofs or mount -t autofs will show you mounted autofs points.

The issue with the /etc/init.d/autofs status command is due to the now widespread use of systemd instead of init style (e.g. SysV) for initialization / PID 1 / user space bringup.

On systemd systems there is an equivalent command:

systemctl status proc-sys-fs-binfmt_misc.automount

which provides output in this format

‚óŹ proc-sys-fs-binfmt_misc.automount - Arbitrary Executable File Formats File System Automount Point
   Loaded: loaded (/usr/lib/systemd/system/proc-sys-fs-binfmt_misc.automount; static; vendor preset: disabled)
   Active: active (running) since Fri 2016-06-10 05:01:07 EDT; 2h 42min ago
    Where: /proc/sys/fs/binfmt_misc
     Docs: https://www.kernel.org/doc/Documentation/binfmt_misc.txt
           http://www.freedesktop.org/wiki/Software/systemd/APIFileSystems

That command doesn't exactly jump off the finger tips, but if it something you would run frequently you could setup an alias for it. In bash shell, alias autofsStat='systemctl status proc-sys-fs-binfmt_misc.automount

I think everything you are looking for is there, but has changed slightly. If you have situations / PCs where it definitely doesn't work, please update the question with the specific environment and I can help dig into it. It could be bug, really old version (or both), or potentially a configuration issue.

If I missed the target on this answer, just let me know more specifics about your problems.