9 Feb 2014
autofs - Format of the automounter maps
The automounter maps are FILE, NIS, NISPLUS or LDAP (including LDAP via SSS) referred to by the master map of the automounter (see auto.master(5)). These maps describe how file systems below the mount point of the map (given in the master map) are to be mounted. This page describes the sun map format; if another map format, other than amd , is specified (e.g. hesiod), this documentation does not apply.
Indirect maps, except for the internal hosts map, can be changed on the fly and the automouter will recognize those changes on the next operation it performs on that map. Direct maps require a HUP signal be sent to the daemon to refresh their contents as does the master map.
This is a description of the text file format. Other methods of specifying these files may exist. All empty lines or lines beginning with # are ignored. The basic format of one line in such maps is:
key [-options] location
|key||For indirect mounts this is the part of the path name between the mount point and the path into the filesystem when it is mounted. Usually you can think about the key as a sub-directory name below the autofs managed mount point.
For direct mounts this is the full path of each mount point. This map is always associated with the /- mount point in the master map.
|Zero or more options may be given. Options can also be given in the auto.master file in which case both values are cumulative (this is a difference from SunOS). The options are a list of comma separated options as customary for the mount(8) command.
There are several special options
|The location specifies from where the file system is to be mounted. In the most cases this will be an NFS volume and the usual notation host:pathname is used to indicate the remote filesystem and path to be mounted. If the filesystem to be mounted begins with a / (such as local /dev entries or smbfs shares) a : needs to be prefixed (e.g. :/dev/sda1).|
Example NFS mount map:
Assuming we have the autofs master map entry:
And the following map in /etc/amd.test:
/defaults type:=nfs;rhost:=bilbo apps rfs:=/autofs util rhost:=zeus;rfs:=/work/util local rfs:=/shared;sublink:=local
In the first line we have an NFS remote mount of the exported directory /autofs from host bilbo which would be mounted on /test/apps. Next another nfs mount for the exported directory /work/util from host zeus. This would be mounted on /test/util.
Finally, we have an example of the use of the sublink option. In this case the filesystem bilbo:/shared would be mounted on a path external the automount directory (under the direcory given by configuration option auto_dir) and the path /test/local either symlinked or bind mounted (depending on the setting autofs_use_lofs) to the "local" subdirectory of the external mount.
The amd parser key matching is unusual.
The key string to be looked up is constructed by prepending the prefix, if there is one.
The resulting relative path string is matched by first trying the sting itself. If no match is found the last component of the key string is replaced with the wilcard match cahracter ("*") and a wildcard match is attemted. This process continues until a match is found or until the last match, against the wilcard match key alone, fails to match a map entry and the key lookup fails.
Macros are used a lot in the autofs amd implementation.
Many of the option values are set as macro variables corresponding to the option name during the map entry parse. So they may be used in subsequent option values. Beware though, the order in which option values is not necessarily left to right so you may get unexpected results.
This version of the automounter supports direct maps stored in FILE, NIS, NISPLUS and LDAP (including LDAP via SSS) only.
This is a description of the text file format. Other methods of specifying mount map entries may be required for different map sources. All empty lines or lines beginning with # are ignored. The basic format of one line in such maps is:
|key||A key is a path (or a single path component alone) that may end in the wildcard key, "*", or the wildcard key alone and must not begin with the "/" character.|
|Following the key is a mount location-list.|
|A location-list list has the following syntax:
location[ location[ ... ]] [|| location[ location[ ... ]]
|A mount location-list can use the cut operator, ||, to specify locations that should be tried if none of the locations to the left of it where selected for a mount attempt.
A mount location consists of an optional colon separated list of selectors, followed by a colon separated list of option:=value pairs.
The selectors that may be used return a value or boolean result. Those that return a value may be to used with the comparison operators == and != and those that return a boolean result may be negated with the !.
For a location to be selected for a mount attempt all of its selectors must evaluate to true. If a location is selected for a mount attempt and succeeds the lookup is completed and returns success. If the mount attempt fails the procedure continues with the next location until they have all been tried.
In addition, some selectors take no arguments, some one argument and others optionally take two arguments.
The selectors that take no arguments are:
|The selectors that take one argument are:|
|The selectors that take up to two arguments are:|
|The options that may be used are:|
|A number of options aren’t available or aren’t yet implemented|
|within autofs, these are:
To be able to use IPv6 within autofs maps the package must be build to use the libtirpc library for its RPC communications. This is becuase the glibc RPC implementation doesn’t support IPv6 and is depricated so this is not likely to change.