How to Identify automount mount path

2

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.

user12345

Posted 2016-06-10T08:25:08.970

Reputation: 121

Answers

1

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.

Argonauts

Posted 2016-06-10T08:25:08.970

Reputation: 4 000

automount -m i guess it was introduced around automount version 5. In older version -m switch doesn't exist ( Linux automount version 4.1.3-238). I am looking for a way to fetch automount details across all automount versions and all platforms(Linux, AIX, MAC, solaris,..). I verified the other commands you provided df -a -t autofs or mount -t autofs which are not working in machine where automount version was 5+. Please suggest. – user12345 – 2016-06-10T13:03:29.670

The filtered grep of the config file isn't sufficient? I'll update if i can come up with something better. At the least the service status issue is resolved. – Argonauts – 2016-06-10T13:08:34.487

As you explained, filtered grep will not be feasible for Multiple master, indirect maps, LDAP. So that may not scale down. – user12345 – 2016-06-10T13:23:11.280

I haven't found any other solution yet, Any luck? – user12345 – 2016-06-15T05:02:58.913

It seems df -a -t autofs doesnt work on machines which has automount version 5+. So i am left with no option as of now. – user12345 – 2016-06-15T05:54:26.040