Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ automount(1M) — Interactive 3.2r4.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mount(1M)

df(1M)

passwd(4)

automount(1M)  —  

NAME

automount − automatically mount NFS file systems

SYNOPSIS

automount [ −mnTv ] [ −D envar=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 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. 

The automount daemon appears to be an NFS server to the kernel.  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 (5 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 path name of a mount point with a remote file system to mount. 

If the directory argument is a path name, 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 Network Information Service (NIS) map; if a file, the map argument must be a full path name. 

The −mount-options argument, when supplied, is a comma-separated list of NFS mount(1M) options, preceded by a “−.” 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 envar=value
Assign value to the indicated automount (environment) ­variable. 

−f master-file
Read a local file for initialization before the auto.master NIS map. 

−M mount-directory
Mount temporary file systems in the named directory, instead of /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 (300 seconds).

−tm interval
Specify an interval, in seconds, between attempts to mount a file system. The default is 30 seconds.

−tw interval
Specify an interval, in seconds, between attempts to unmount file systems that have exceeded their cached times. The default is 1 minute (60 seconds).

ENVIRONMENT

Environment variables can be used within an automount map.  For example, 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, you can surround the variable name with curly braces. 

USAGE

Map Entry Format

A simple map entry (mapping) takes the form:

directory [ −mount-options ] location ...

where directory is the full path name 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 NFS 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 path name 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 new-line with a backslash (\).  Comments begin with a # and end at the subsequent new-line. 

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 example, 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 ... ] ...

The initial / within the “/[subdirectory]” is required; the optional subdirectory is taken as a file name 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,intrloco:/usr/localalt:/usr/local   \
/bin−ro,intralt:/usr/local/binloco:/usr/local/bin   \
/man−ro,intrloco:/usr/local/manalt:/usr/local/man

automount would automatically mount /usr/local, /usr/local/bin, and /usr/local/man, as needed, from either loco 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 want 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

mapname can either be a file name, or the name of an NIS map, or one of the special maps described below. 

Special Maps

There are three special maps currently available: −hosts, −passwd, and −null.  The −hosts map uses the hostname resolution facilities available on the system 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 on hermes.  The −passwd map uses the passwd(4) database to attempt to locate the home directory of a user.  For example, if the following automount command is already in effect:

automount  /homes  −passwd

then 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 will mount the user’s home directory as: /homes/username. 

For this map, the tilde character “~” is recognized as a synonym for the 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 the −f option is in effect, automount does not look for an auto.master file on the local host. 

Maps given on the command line or in a local auto.master file specified with the −f option override those in the NIS auto.master map.  For example, given the command:

automount −f /etc/auto.master /home −null /− /etc/auto.direct

and a file named /etc/auto.master that contains:

/homes  −passwd

automount would mount home directories under /homes instead of /home, as well as mount the various directories specified in the /etc/auto.direct file. 

FILES

/tmp_mnt directory under which file systems are dynamically mounted

/etc/auto.master list of master NIS configuration maps

/etc/auto.direct list of direct automounter maps

/etc/auto.indirect list of indirect automounter maps

SEE ALSO

mount(1M). 
df(1M) in the INTERACTIVE UNIX System User’s/System Administrator’s Reference Manual. 
passwd(4) in the INTERACTIVE SDS Guide and Programmer’s Reference Manual. 

NOTES

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 (see mount(1M)), automount should be forced to reread the file. 

BUGS

Shell file name expansion does not apply to objects not currently mounted. 

Because 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. 

\*U  —  Version 1.0

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026