automount(8nfs)automount(8nfs)Nameautomount - automatically and transparently mounts and unmounts NFS
/usr/etc/automount [ -mnTv ] [ -D name= value ] [ -f master-file ]
[ -M mount-directory ] [ -tl duration ] [ -tm interval ] [ -tw interval
[ directory mapname [ - mount-options ]]
The command transparently mounts and unmounts NFS file systems on an
as-needed basis. It is useful for mounting file systems and directo‐
ries that are needed only occasionally, and it provides an alternative
to using for NFS mounting file systems on client machines.
The program can be started from the file or the command line. The dae‐
mon forked by the program sleeps until a user attempts to access a
directory that is associated with an map. The daemon then consults the
appropriate map and mounts the NFS file system. If the indicated
directory has not already been created, the daemon creates it and
removes it after automatic
Local maps are typically located in the directory but can be placed in
any directory. You also can use the Yellow Pages Service to distribute
maps. The maps indicate where to find the file system to be mounted,
the local mount point, and mount options. After a specified period of
inactivity on a file system, 5 minutes by default, the daemon unmounts
that file system.
An individual automount map is either local or served by the Yellow
Pages. A system, however, can use both local and Yellow Pages auto‐
mount maps. When a map is referenced, the program first looks for the
designated mapname locally. If it cannot find the mapname locally, it
looks for a Yellow Pages map by that name. The names of the maps are
passed to from the command line, or from a master map.
If the command line and the master map contain contradictory arguments,
those on the command line take precedence.
By default, the daemon mounts the remote file system under the direc‐
tory and creates a symbolic link between the requested and the actual
Conventionally, maps are files that are located in the directory with
names that have the prefix They indicate which remote file systems to
mount, where to mount them, and which options to use.
The Master Map
The program can consult a master map, which contains entries that point
to other maps that can be either direct or indirect. If Yellow Pages
is running, checks for the presence of a YP map named You are not
required to run YP or have an map. A master map can also be a file
whose location is specified with the command line option.
The master map provides with a list of maps, and with arguments that
pertain to each of the maps. Each line in the master map has the fol‐
mount-point map [mount-options]
· Mount-point is the full pathname of a local directory if the map
argument is the name of an indirect map or the name of a special
map. If the map argument is the name of a direct map, the dummy
directory ``/-'' is specified as the mount-point.
· Map is the name of the map the automount command uses to find the
mount points and locations. This can either be a filename, a YP
map name, or a special map name.
· Mount-options is a list of options used to regulate the mounting of
entries listed in map.
Direct maps specify which remote file systems to mount locally and what
the local mount points are. They do not point to other maps. They also
can specify mount options. Direct maps have the following syntax:
key [mount-options] location
· Key is the full pathname of the mount point.
· Mount-options are the options for this specific mount. When
present, these options override any mount options specified on the
command line or in the master map.
· Location is the location of the resource being mounted, specified
as: server:pathname. Multiple location fields can be specified, in
which case sends multiple mount requests and mounts from the first
server to respond.
Indirect maps have the same format as direct maps. The only difference
between a direct and an indirect map is that the key in a direct map is
a full pathname, whereas the key in an indirect map is a simple name
that does not begin with a slash. (Remember that the indirect map as a
whole has been associated with a directory specified in the master map
or on the command line. The entries in an indirect map list subdirec‐
tories that are individually mounted within the directory associated
with the map.)
The map is a special map that is used to access all directories
exported by a server to a client.
The following command allows a client to access directories that are
exported from any host in its file, the Yellow Pages hosts database, or
the BIND database.
# automount /net -hosts
For example, suppose that and are both hosts on a local area network
that is running Yellow Pages. If the file on contains the command then
users on can access any directories that exports to All of the exported
directories are mounted under on
The map, when indicated on the command line, cancels the map associated
with the directory indicated. It can be used to cancel a map specified
in the master map. For example, invoking the command in the following
manner causes the entry in to be ignored:
# automount /net -null
The ampersand (&) is expanded into the key field in a map wherever it
appears. In the following example, the ampersand (&) expands to
#key mount_options location
The asterisk (*), when supplied as the key field, is recognized as the
catch-all entry. It is used to substitute for lines that are all for‐
matted similarly. Any entry following the asterisk is ignored. In the
following example, the program uses the asterisk to match any hostname
#key mount_options location
The value of an environment variable can be used within an automount
map by prefixing a dollar sign ($) to its name. You can also use
braces to delimit the name of the variable from appended letters or
digits. The environment variables can be inherited from the environ‐
ment or can be explicitly defined with the command line option.
You can mount different directories within an file system hierarchy
from different servers. For example, if you are mounting the file sys‐
tem on your machine, you can mount the various subdirectories within
from different servers.
In the following example, the directories and are mounted from the
machines host1, host2, host3, and host4 respectively. When the root of
the hierarchy is referenced, the program mounts the whole hierarchy.
/ -ro host1:/usr/local \
/bin -ro host2:/usr/local/bin \
/src -ro host2:/usr/local/src \
/tools -ro host2:/usr/src/tools
Readability has been improved by splitting the entry into five lines
and indenting the continuation lines.
Options-m Ignores directory-mapname pairs listed in the Yellow Pages
-n Disables dynamic mounts. Lookups intercepted by the daemon
succeed when the target file system has been previously
-T Traces all NFS requests received by the daemon. Information
about the details of the request are expanded and sent to
-v Logs status messages to the console. (Stands for ``ver‐
Defines an environment variable by assigning value to the
Uses master-file for a list of initial directory to mapname
pairs, ahead of the Yellow Pages map. If an entry exists in
both master-file and that specified in master-file is used
since it is read first. Similarly, entries on the command
line take precedence over master-file entries. This tech‐
nique can be used to replace entries in global maps with your
Uses mount-directory instead of the default,
Specifies a duration in seconds, that a file system is to
remain mounted when not in use. The default is 5 minutes.
Specifies an interval in seconds, between attempts to mount a
file system. The default is 30 seconds.
Specifies an interval in seconds, between attempts to unmount
file systems that have exceeded their cached times. The
default is 1 minute.
Specifies the mount options to be applied to all of the
directories listed in mapname. If mount options are listed
in the specified map, they take precedence over these
options. Sending the SIGINIT signal to the daemon causes it
to kill and restart the code.
Sending the SIGTERM signal to the daemon causes it to unmount
all file systems that it has mounted, and to exit.
Sending the SIGHUP signal to the daemon causes it to reread
the system mount table to update its internal record of cur‐
rently mounted file systems. If a file system mounted with
is unmounted by a command, should be forced to reread the
system mount table.
Shell filename expansion does not apply to objects not currently
Because is single-threaded, any request that is delayed by a slow or
non-responding NFS server will delay all subsequent requests until the
delayed request has been completed.
The following is a sample map:
# mount-point mapname mount-options
/home auto.indirect -rw
/- auto.direct -ro,intr
The following is a typical indirect map:
# key mount-options location
The following is a typical direct map:
# key mount-options location
/usr/source -ro merge:/usr/src/proto
The following is a sample indirect map that specifies multiple mount
locations for the file system The file system is mounted from the first
server to respond to the request.
reference -ro earl:/usr/src/ref\
Directory where automounted file systems reside
See Alsomount(8), mount(8nfs), umount(8)
Guide to the Network File System