Как определить путь монтирования автомонтирования

2701
user12345

Мне нужно знать все точки монтирования, контролируемые autofs/automount.

Я сталкивался с " automount -m" в dumpmaps и " /etc/init.d/autofs status" в более старых версиях. Но эти команды не работают во всех версиях автомонтирования и доступны не на всех платформах, таких как Linux, AIX, MAC.

Так есть ли способ получить эту информацию без разбора auto.master/auto_master.

2

1 ответ на вопрос

1
Argonauts

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.

`automount -m`, я думаю, это было введено в версии 5 автомонтирования. В более старой версии ключ -m не существует (версия автомонтирования Linux 4.1.3-238). Я ищу способ извлечения деталей автомонтирования для всех версий автомонтирования и всех платформ (Linux, AIX, MAC, solaris, ...). Я проверил другие предоставленные вами команды `df -a -t autofs` или` mount -t autofs`, которые не работают на машине, где версия автомонтирования была 5+. Пожалуйста, предложите. user12345 7 лет назад 0
Отфильтрованный grep файла конфигурации не достаточно? Я обновлю, если смогу придумать что-нибудь получше. По крайней мере, проблема статуса сервиса решена. Argonauts 7 лет назад 0
Как вы объяснили, отфильтрованный grep будет неосуществим для нескольких основных, косвенных карт и LDAP. Так что это может не уменьшиться. user12345 7 лет назад 0
Я не нашел другого решения, Удачи? user12345 7 лет назад 0
Кажется, `df -a -t autofs` не работает на машинах с версией автомонтирования 5+. Так что у меня нет выбора на данный момент. user12345 7 лет назад 0