automount(1M)
NAME
automount − automatically mount NFS file systems
SYNOPSIS
automount [ −nTv ] [ −D name=value ] [ −f mastermap ] [ −M mount-directory ]
[ −t sub-options ] [ directory map [ −mount-options ] ] ...
/usr/lib/nfs/automount
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 automount maps, as well as any directories or files that reside under them. When such an access is made, the daemon mounts the appropriate NFS file system if necessary. You can assign a map to a directory using an entry in the /etc/auto_master map or a direct map, or by arguments to the automount 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.
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 refers to an indirect map. Each entry in an indirect map corresponds to a name within the indicated directory. The map argument can be the name of a name service map or the full pathname of a local file.
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.
OPTIONS
−n Disable dynamic mounts. With this option, references through the automount daemon succeed only 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.
−f masterfile
Use a name service map or local file (if a full pathname) as the master map.
−M mount-directory
Mount temporary file systems in the named directory, instead of /tmp_mnt.
−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 timeout
Specify an timeout, in seconds, for 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.
USAGE
Map Entry Format
A simple map entry (mapping) takes the form:
key [ −mount-options ] location . . .
where key is the full pathname of the directory to mount when used in a direct map, or the simple name 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
host is the name of the host from which to mount the file system, and pathname is the pathname of the directory to mount.
Replicated Filesystems
Multiple location fields can be specified for replicated filesystems, in which case automount sends multiple mount requests; automount mounts the file system from the first server that replies to the mount request. This request is first made to any servers on the local net or subnet. If there is no response, the request is sent to all named servers.
If each location in the list shares the same pathname then a single location may be used with a comma-separated list of hostnames:
hostname,hostname...:pathname
Requests for a server may be weighted, with the weighting factor appended to the server name as an integer in parenthesis. Servers without a weighting are assumed to have a value of zero (most likely to be selected). Progressively higher values decrease the chance of being selected. In the example,
able −ro alpha,bravo,charlie(1),delta(4):/usr/man
hosts alpha and bravo have the highest priority; host delta, the lowest.
Note: Server proximity takes priority in the selection process. In the example above, if the server delta is on the same network segment as the client, but the others are on a different network segments, then delta will be selected — the weighting value is ignored. The weighting has effect only when selecting between servers with the same network proximity.
In cases where each server has a different export point, you can still apply the weighting. For example:
able −ro alpha:/usr/man bravo,charlie(1):/usr/share/man delta(3):/export/man
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.
Map Key Substitution
The & character is expanded to the value of the key field for the entry in which it occurs. In this case:
ablehomeboy:/home:&
the & expands to able.
Wildcard Key
The ∗ character, when supplied as the key field, is recognized as the catch-all entry. Such an entry will match any key not previously matched. For instance, if the following entry appeared in the indirect map for /src:
∗&:/export/src/&
this would allow automatic mounts in /src of any remote file system whose location could be specified as:
hostname:/export/src/hostname
Environment Variable Substitution
Environment variables can be used within an automount map. For instance, if $HOSTNAME appeared within a map, automount would expand it to its current value for the HOSTNAME variable. Environment variables are expanded only for the automounter’s environment — not for the environment of a user using the automounter’s services.
The special reference to ARCH is predefined to be the output of the arch command, for example, "sun4".
If a reference needs to be protected from affixed characters, you can surround the variable name with curly braces ({}).
Multiple Mounts
A multiple mount entry takes the form:
key [−mount-options] [[mountpoint] [−mount-options] location...]...
The initial /[mountpoint] is optional for the first mount and mandatory for all subsequent mounts. The optional mountpoint is taken as a pathname relative to the destination of the symbolic link for key. If mountpoint is omitted in the first occurrence, a mountpoint of / is implied.
Given the direct map entry:
/arch/src −ro,intr \
/arch,alt:/arch/src \
/1.0arch,alt:/arch/src/1.0 \
/1.0/manarch,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 that is listed as a key 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. In an indirect map, each key consists of a simple name that refers to one or more filesystems that are 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 assumed to be the name of a name service map, or the full pathname of a local file, or one of the special maps described below. The name service is determined by the name service switch entry for the automounter in /etc/nsswitch.conf. If the name service is files then the name is assumed to be that of a local file in /etc. If the name begins with a slash (/), then it is assumed to be the full path to a local file no matter what the name service is. If the key being searched for is not found in the included map, the search continues with the next entry.
Special Maps
There are two special maps available: −hosts and −null. The −hosts map invokes netdir_getbyname () to locate a remote host when the hostname is specified. This map specifies mounts of all exported file systems from any host. For instance, if the following automount command is already in effect:
automount /net −hosts
then a reference to /net/hermes/usr would initiate an automatic mount of all file systems from hermes that automount can mount; references to a directory under /net/hermes will refer to the corresponding directory relative to hermes root.
The −null map, when indicated on the command line, cancels a previous map for the directory indicated. This is most useful in the /etc/auto_master for cancelling entries that would otherwise be inherited from the +auto_master include entry. To be effective, the −null entries must be inserted before the included map entry.
Configuration and the auto_master Map
When initiated without arguments, automount normally consults the /etc/auto_master map for a list of initial automount maps, and sets up automatic mounts for them in addition to those given on the command line. You can use the −f option to specify an alternative to /etc/auto_master. If there are duplications, the command-line arguments take precedence over the master map.
FILES
/tmp_mnt parent directory for dynamically mounted file systems.
/etc/auto_master master automount map.
/etc/auto_home map to support automounted home directories.
SEE ALSO
NOTES
The −hosts map must mount all the exported filesystems from a server. If frequent access to just a single filesystem is required, it is more efficient to access the filesystem with a map entry that is tailored to mount just the filesystem of interest.
When it receives signal number 1 (SIGHUP), 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.
Mount points for a single automounter must not be hierarchically related. automount does not allow an automount mount point to be created within an automounted filesystem.
automount must not be terminated with the SIGKILL signal (kill −9). Without an opportunity to unmount itself, the automount mount points will appear to the kernel to belong to a non-responding NFS server. The recommended way to terminate automount services is to send a SIGTERM (kill −15) signal to the daemon. This allows the automounter to catch the signal and unmount not only its daemon but also any mounts in /tmp_mnt. Mounts in /tmp_mnt that are busy will not be unmounted.
Since each direct map entry results in a separate mount for the mount daemon, such maps should be kept short. Entries added to a direct map will have no effect until the automounter is restarted.
Since automount is single-threaded, any request that is delayed by a slow or non-responding NFS server or name service will delay all subsequent automounted mount requests until it completes.
Programs that read /etc/mnttab and then touch files that reside under direct mount points will introduce further entries to the file. Similarly, if a directory contains any direct map mountpoints then an ls −l in the directory will force all the direct map mounts to occur. This is not a problem for indirect maps.
Entries in both direct and indirect maps can be modified at any time. The new information is used when automount next uses the map entry to do a mount. automount does not cache map entries.
New entries added to a master map or direct map will not be acknowledged by automount until it is restarted. New entries added to an indirect map may be used immediately.
The directory associated with an indirect map shows only currently-mounted entries. This is a deliberate policy to avoid inadvertent mounting of every entry in a map via an ls −l of the directory.
The multiple location feature allows the automounter to choose the most appropriate server at mount time. While such a mount is in effect, the automounter does not monitor the status of the server. If the server crashes, the automounter will not select an alternative server from the list.
The Network Information Service (NIS) was formerly known as Sun Yellow Pages (YP). The functionality of the two remains the same.
SunOS 5.1 — Last change: 5 Jul 1990