automount(1Mnfs)


automount -- automatically mount NFS filesystems

Synopsis

/usr/lib/nfs/automount [-nTv] [-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® filesystem 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 filesystem.

automount uses a map to locate an appropriate NFS file server, exported filesystem, and mount options, for an automatically mounted resource. It then mounts the filesystem in a temporary location (/tmp_mnt), and replaces the filesystem entry for the directory or subdirectory with a symbolic link to the temporary location. If the filesystem is not accessed within an appropriate interval (five minutes by default), the daemon unmounts the filesystem and removes the symbolic link. If the indicated directory (/tmp_mnt) has not already been created, the daemon creates it, and then removes it upon exiting.

Options

automount takes the following options:

-n
Disable dynamic mounts. With this option, references through the automount daemon only succeed 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 output.

-v
Verbose. Log status messages to the console.

-D name=value
Assign value to the indicated automount (environment) variable.

-f master-file
Specify all arguments in master-file and instruct the daemon to look in it for instructions.

-M mount-directory
Mount temporary filesystems 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 filesystem is to remain mounted when not in use. The default is 300 seconds.

m interval
Specify an interval, in seconds, between attempts to mount a filesystem. The default is 30 seconds.

p duration
Specify a duration, in seconds, that automount will wait for a response from the server to a ping when deciding if it can mount a filesystem. The default is 15 seconds.

w interval
Specify an interval, in seconds, between attempts to unmount filesystems that have exceeded their cached times. The default is 60 seconds.

Environment variables

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.

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

Replicated filesystems

Multiple location fields can be specified, in which case automount sends multiple mount requests; automount mounts the filesystem 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 filesystem may be accessed. With a map for /home such as:
   able	homebody:/home/homebody:able
   baker	homebody:/home/homebody:baker
and a user attempting to access a file in /home/able, automount mounts homebody:/home/homebody, but creates a symbolic link called /home/able to the able subdirectory in the temporarily mounted filesystem. 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/homebody is already mounted. With the following map:
   able	homebody:/home/homebody/able
   baker	homebody:/home/homebody/baker
automount would have to mount the filesystem twice.

Requests for a server may be weighted by appending an integer weighing factor, within parenthesis, to the server name. The higher the weighing factor value, the lower the chance that the server will be selected. Servers for which no weighing factor is specified are assumed to have a value of zero (most likely to be selected). In the example:

   able -ro alpha,bravo,charlie(1),delta(4):/usr/man
hosts alpha and bravo have the highest selection priority, while host delta has the lowest.


NOTE: Server proximity takes priority over weighing factors during server selection.

In the example above, if the server delta is on the same network segment as the client, and the other servers reside on other network segments, then automount would select delta (ignoring delta's high weighing factor). In cases where servers have the same network proximity, their weighing factors are taken into account during selection.

In cases where each server has a different export point, you can still assign weighing factors. For example:

   able -ro alpha:/usr/man bravo,charlie(1):/usr/share/man\
   delta(4):/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 directory field for the entry in which it occurs. In this case:
   able	homebody:/home/homebody:&
the ``&'' expands to able.

Wildcard key

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.


NOTE: 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 a ls -l of the directory.

Special maps

Three special maps are currently available:

-hosts
Use 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 filesystems 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 filesystems from hermes that automount can mount; references to a directory under /net/hermes will refer to the corresponding directory on hermes.


-null
When indicated on the command line, cancel a previous map for the directory indicated. For example, it can be used to cancel a map given in auto.master.

-passwd
Use the passwd(4) database to attempt to locate the home directory of a user. For instance, 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.

Including NIS maps

The contents of a Network Information Service (NIS) map can be included in an automounter map using an entry of the form
   +mapname
in the automounter map on the NIS client, where mapname is the name of the NIS map to be included at that point in the automounter map.

For example, to include the contents of the map auto.master on the NIS master server within the automounter master map on an NIS client, add an entry that specifies

   +auto.master
in the /etc/auto.master file on the NIS client. To include the contents of the NIS map auto.home, add an entry that specifies
   +auto.home
in the /etc/auto.home file on the NIS client.

Files


/etc/auto.master
default master map file

/etc/auto.home
default direct/indirect map file

/tmp_mnt
default parent directory for dynamically mounted filesystems

Usage

You can assign a map to a directory using an entry in a direct automount map, by specifying a master-map on the command line, or by specifying an indirect map.

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

You can modify the automounter maps at any time. However, observe the following when doing so:

The -mount-options argument, when supplied, is a comma-separated list of mount(1Mnfs) options, preceded by a hyphen ``-''. If mount options are specified in the indicated map, however, those in the map take precedence.

Only a privileged user can execute this command.

Warnings

automount must not be terminated with the SIGKILL signal (kill -9). Without an opportunity to unmount itself, automount's mount points will appear to the kernel as belonging to a non-responding NFS server. The recommended way to terminate automount services is to send a SIGTERM (kill -15, the default signal) to the daemon. This allows the automounter to catch the signal, and to unmount not only the mount points associated with its daemon, but also to unmount any mounts in /tmp_mnt.


NOTE: Any mounts in /tmp_mnt that are busy will not be unmounted.

Mount points used by automount are not recorded in /etc/mnttab. mount(1Mnfs) on such mount points will fail, saying mount point busy, although the mount point is not in /etc/mnttab.

Shell filename expansion does not apply to objects not currently mounted.

References

df(1M), mount(1Mnfs), passwd(4)

``Using the NFS automounter'' in Configuring and administering NFS

Notices

By default, automount will first try and mount a filesystem using NFSv3. If unsuccessful, it will then retry using NFSv2. If necessary, you can use the vers mount option (see mount(1Mnfs)) to specify that automount should only use NFSv2 or NFSv3.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004