automount(1M) — ADMINISTRATOR COMMANDS
NAME
automount − automatically mount NFS file systems
SYNOPSIS
/usr/lib/nfs/automount [−mnTv] [−D name=value] [−M mount-directory] [−f master-file]
[−t sub-options] [directory map [−mount-options] ] . . .
DESCRIPTION
automount is a daemon that automatically and transparently mounts an NFS file system as needed. It monitors attempts to access directories that are associated with an automount map, along with any directories or files that reside under them. When a file is to be accessed, the daemon mounts the appropriate NFS file system. You can assign a map to a directory using an entry in a direct automount map, or by specifying an indirect map on the command line.
automount uses a map to locate an appropriate NFS file server, exported file system, and mount options. It then mounts the file system in a temporary location, and replaces the file system entry for the directory or subdirectory with a symbolic link to the temporary location. If the file system is not accessed within an appropriate interval (five minutes by default), the daemon unmounts the file system and removes the symbolic link. If the indicated directory has not already been created, the daemon creates it, and then removes it upon exiting.
Since the name-to-location binding is dynamic, updates to an automount map are transparent to the user. This obviates the need to “pre-mount” shared file systems for applications that have “hard coded” references to files.
If you specify the dummy directory /−, automount treats the map argument that follows as the name of a direct map. In a direct map, each entry associates the full pathname of a mount point with a remote file system to mount.
If the directory argument is a pathname, the map argument points to a file called an indirect map. An indirect map contains a list of the subdirectories contained within the indicated directory. With an indirect map, it is these subdirectories that are mounted automatically. The map argument must be a full pathname.
The −mount-options argument, when supplied, is a comma-separated list of mount(1M) options, preceded by a hyphen (−). If mount options are specified in the indicated map, however, those in the map take precedence.
The following options are available:
−m Suppress initialization of directory-map pairs listed in the auto.master NIS database.
−n Disable dynamic mounts. With this option, references through the automount daemon only succeed when the target file system has been previously mounted. This can be used to prevent NFS servers from cross-mounting each other.
−T Trace. Expand each NFS call and display it on the standard output.
−v Verbose. Log status messages to the console.
−D name=value
Assign value to the indicated automount (environment) variable.
−M mount-directory
Mount temporary file systems in the named directory, instead of /tmp_mnt.
−f master-file
Read a local file for initializaton ahead of the auto.master NIS map.
−t sub-options
Specify sub-options as a comma-separated list that contains any combination of the following:
l duration
Specify a duration, in seconds, that a file system is to remain mounted when not in use. The default is 5 minutes.
m interval
Specify an interval, in seconds, between attempts to mount a file system. The default is 30 seconds.
w interval
Specify an interval, in seconds, between attempts to unmount file systems that have exceeded their cached times. The default is 1 minute.
ENVIRONMENT
Environment variables can be used within an automount map. For instance, if $HOME appeared within a map, automount would expand it to its current value for the HOME variable.
If a reference needs to be protected from affixed characters, enclose the variable name within braces.
USAGE
Direct/Indirect Map Entry Format
A simple map entry (mapping) takes the form:
directory [ −mount-options ] location . . .
where directory is the full pathname of the directory to mount when used in a direct map, or the basename of a subdirectory in an indirect map. mount-options is a comma-separated list of mount options, and location specifies a remote file system from which the directory may be mounted. In the simple case, location takes the form:
host:pathname
Multiple location fields can be specified, in which case automount sends multiple mount requests; automount mounts the file system from the first host that replies to the mount request. This request is first made to the local net or subnet. If there is no response, any connected server may respond.
If location is specified in the form:
host:path:subdir
host is the name of the host from which to mount the file system, path is the pathname of the directory to mount, and subdir, when supplied, is the name of a subdirectory to which the symbolic link is made. This can be used to prevent duplicate mounts when multiple directories in the same remote file system may be accessed. With a map for /home such as:
ablehomeboy:/home/homeboy:able
bakerhomeboy:/home/homeboy:baker
and a user attempting to access a file in /home/able, automount mounts homeboy:/home/homeboy, but creates a symbolic link called /home/able to the able subdirectory in the temporarily mounted file system. If a user immediately tries to access a file in /home/baker, automount needs only to create a symbolic link that points to the baker subdirectory; /home/homeboy is already mounted. With the following map:
ablehomeboy:/home/homeboy/able
bakerhomeboy:/home/homeboy/baker
automount would have to mount the file system twice.
A mapping can be continued across input lines by escaping the NEWLINE with a backslash. Comments begin with a # and end at the subsequent NEWLINE.
Directory Pattern Matching
The & character is expanded to the value of the directory field for the entry in which it occurs. In this case:
ablehomeboy:/home/homeboy:&
the & expands to able.
The ∗ character, when supplied as the directory field, is recognized as the catch-all entry. Such an entry resolves to any entry not previously matched. For instance, if the following entry appeared in the indirect map for /home:
∗&:/home/&
this would allow automatic mounts in /home of any remote file system whose location could be specified as:
hostname:/home/hostname
Hierarchical Mappings
A hierarchical mapping takes the form:
directory [/[subdirectory]] [−mount-options] location...
[/[subdirectory] [−mount-options] location...].
The initial /[subdirectory] is optional for the first location list and mandatory for all subsequent lists. The optional subdirectory is taken as a filename relative to the directory. If subdirectory is omitted in the first occurrence, the / refers to the directory itself.
Given the direct map entry:
/arch/src \
/ −ro,intr arch:/arch/src alt:/arch/src \
/1.0 −ro,intr alt:/arch/src/1.0 arch:/arch/src/1.0 \
/1.0/man −ro,intr arch:/arch/src/1.0/man alt:/arch/src/1.0/man
automount would automatically mount /arch/src, /arch/src/1.0 and /arch/src/1.0/man, as needed, from either arch or alt, whichever host responded first.
Direct Maps
A direct map contains mappings for any number of directories. Each directory listed in the map is automatically mounted as needed. The direct map as a whole is not associated with any single directory.
Indirect Maps
An indirect map allows you to specify mappings for the subdirectories you wish to mount under the directory indicated on the command line. It also obscures local subdirectories for which no mapping is specified. In an indirect map, each directory field consists of the basename of a subdirectory to be mounted as needed.
Included Maps
The contents of another map can be included within a map with an entry of the form
+mapname
where mapname is a filename.
Special Maps
The −null map is the only special map currently available. The −null map, when indicated on the command line, cancels a previous map for the directory indicated.
FILES
/tmp_mnt parent directory for dynamically mounted file systems
SEE ALSO
NOTES
When it receives signal number 1, automount rereads the /etc/mnttab file to update its internal record of currently-mounted file systems. If a file system mounted with automount is unmounted by a umount command, automount should be forced to reread the file.
Shell filename expansion does not apply to objects not currently mounted.
Since automount is single-threaded, any request that is delayed by a slow or non-responding NFS server will delay all subsequent automatic mount requests until it completes.
Programs that read /etc/mnttab and then touch files that reside under automatic mount points will introduce further entries to the file.
— NFS