automount(1M)
NAME
automount − automatically mount NFS file systems
SYNOPSIS
automount [-mnTv] [-D name = value] [-f master-file] [-M mount-directory] [-tl duration]
[-tm interval] [-tw interval] [directory map [−mount-options] ] ...
DESCRIPTION
automount is a daemon that automatically and transparently mounts NFS file systems 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. Maps can be assigned to a directory by using an entry in a direct automount map, or by specifying an indirect map on the command line.
automount interacts with the kernel in a manner closely resembling an NFS server:
• automount uses the 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 specified directory has not already been created, the daemon creates it, and then removes it upon exiting.
Since name-to-location binding is dynamic, updates to an automount map are transparent to the user. This obviates the need to mount shared file systems prior to running applications that contain internally hard-coded references to files.
If the dummy directory (/-) is specified, 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 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.
A map can be a file or a NIS map; if a file, the map argument must be a full pathname.
The -mount-options argument, when supplied, is a comma-separated list of options to the mount command (see mount(1M)) preceded by a −. However, any conflicting mount options specified in the indicated map take precedence.
Options
automount recognizes the following options:
-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 succeed only when the target filesystem 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 error.
-v Verbose. Log status messages to the system log file (see syslogd(1M)).
-D envar = value
Assign value to the indicated automount (environment) variable envar.
-f master-file Read a local file for initialization, ahead of the auto.master NIS map.
-M mount-directory
Mount temporary file systems in the named directory instead of in /tmp_mnt.
-tl duration Specify a duration (in seconds) that a file system is to remain mounted when not in use. The default is 5 minutes.
-tm interval Specify an interval (in seconds) between attempts to mount a filesystem. The default is 30 seconds.
-tw interval Specify an interval (in seconds) between attempts to unmount filesystems that have exceeded their cached times. The default is 1 minute.
ENVIRONMENT
Environment variables can be used within an automount map. For example, if $HOME appears within a map, automount expands it to the current value of the HOME environment variable.
To protect a reference from affixed characters, surround the variable name with curly braces. Environment variables cannot appear as the key entry in maps.
USAGE
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 filesystem 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 is allowed to 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 might be accessed. Assume a map for /users resembling:
mike hpserver1:/users/hpserver1:mike
dianna hpserver1:/users/hpserver1:dianna
Attempting to access a file in /users/mike causes automount to mount hpserver1:/users/hpserver1 and creates a symbolic link called /users/mike to the mike subdirectory in the temporarily-mounted filesystem. A subsequent file access request in /users/dianna results in automount simply creating a symbolic link that points to the dianna subdirectory because /users/hpserver1 is already mounted. Given the map:
mike hpserver1:/users/hpserver1/mike
dianna hpserver1:/users/hpserver1/dianna
automount would have to mount the filesystem twice.
A mapping can be continued across input lines by escaping the new-line character with a backslash (\). Comments begin with a # and end at the subsequent new-line character.
Directory Pattern Matching
The & character is expanded to the value of the directory field for the entry in which it occurs. Given an entry of the form:
mike hpserver1:/users/hpserver1:&
the & expands to mike.
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 example, if the following entry appeared in the indirect map for /users:
* &:/users/&
this would allow automatic mounts in /users of any remote file system whose location could be specified as:
hostname:/users/hostname
Hierarchical Mappings
A hierarchical mapping takes the form:
directory [/ [subdirectory] [- mount-options] location ...] ...
The initial / within the /[subdirectory] is required; 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:
/usr/local \
/ -ro,intr shasta:/usr/local ranier:/usr/local \
/bin -ro,intr ranier:/usr/local/bin shasta:/usr/local/bin \
/man -ro,intr shasta:/usr/local/man ranier:/usr/local/man
automount automatically mounts /usr/local, /usr/local/bin, and /usr/local/man, as needed, from either shasta or ranier, 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 specifying mappings for the subdirectories to be mounted 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
mapname can either be a filename, or the name of an NIS map, or one of the special maps described below.
Special Maps
Three special maps, -hosts, -passwd, and -null, are currently available: The -hosts map uses the gethostbyname() map to locate a remote host when the hostname is specified (see gethostbyname(3C). This map specifies mounts of all exported file systems from any host. For example, if the following automount command is already in effect:
automount /net -hosts
a reference to /net/hermes/usr initiates an automatic mount of all file systems from hermes that automount can mount, and any subsequent references to a directory under /net/hermes refer to the corresponding directory on hermes. The -passwd map uses the passwd(4) database to attempt to locate a user’s home directory. For example, if the following automount command is already in effect:
automount /homes -passwd
if the home directory for a user has the form /dir/server/username, and server matches the host system on which that directory resides, automount mounts the user’s home directory as: /homes/username.
For this map, the tilde character (~) is recognized as a synonym for username.
The -null map, when indicated on the command line, cancels a previous map for the directory indicated. It can be used to cancel a map given in auto.master.
Configuration and the auto.master Map
automount normally consults the auto.master NIS configuration map for a list of initial automount maps, and sets up automatic mounts for them in addition to those given on the command line. If there are duplications, the command-line arguments take precedence. This configuration database contains arguments to the automount command rather than mappings. Unless -f is in effect, automount does not look for an auto.master file on the local host.
Maps given on the command line, or those given in a local auto.master file specified with -f override those in the NIS auto.master map. For example, given the command:
automount /homes /etc/auto.homes /- /etc/auto.direct
and the NIS map file auto.master containing:
/homes -passwd
automount mounts home directories using the /etc/auto.homes map instead of the special -passwd map in addition to the various directories specified in the /etc/auto.direct map.
WARNINGS
Do not send the SIGKILL signal (kill -9, or kill -KILL) to the automount daemon. Doing so causes any processes accessing mount directories served by automount to hang. A system reboot may be required to recover from this state.
Do not start an automount daemon while another is still running. If restarting automount, make sure the first daemon and all of its children are not running.
When automount receives signal SIGHUP, it rereads the /etc/mnttab file to update its internal record of currently mounted file systems. If a file system mounted by automount is unmounted by a umount command, automount should be forced to reread the file by sending the SIGHUP signal (see kill (1)).
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 delays all subsequent automatic mount requests until it completes.
Programs that read /etc/mnttab and then touch files that reside under automatic mount points introduce further entries to the file.
Automatically-mounted file systems are mounted with type ignore; they do not appear in the output of either mount(1M), or bdf(1M).
FILES
/tmp_mnt directory under which filesystems are dynamically mounted
/etc/mnttab mount table
SEE ALSO
Hewlett-Packard Company — HP-UX Release 9.03: April 1994