 |
Index for Section 8 |
|
 |
Alphabetical listing for A |
|
 |
Bottom of page |
|
automount(8)
NAME
automount - Automatically and transparently mounts and unmounts NFS file
systems
SYNOPSIS
/usr/sbin/automount [-hmnpTv] [-D name=value] [-f master-file] [-M mount-
directory] [-tl duration] [-tm interval] [-tw interval] [directory map
[-mount-options]]
OPTIONS
-h Includes the host name in mount-point pathnames. The host name is
inserted just after the mount-directory in a mount-point pathname.
This ensures that NFS mount points to different servers are placed in
separate directories. This avoids a limitation of getwd(3).
-m Ignores directory-mapname pairs listed in the auto.master NIS database.
-n Disables dynamic mounts. Lookups intercepted by the automount daemon
succeed only when the target file system has been previously mounted.
-p Uses local mounts for primary Internet addresses and NFS loopback
mounts for Internet alias addresses. Without this option, the
command's default behavior is to bypass NFS for all local Internet
addresses, including Internet alias addresses.
-T Traces all NFS requests received by the daemon. Information about the
details of the request are expanded and sent to standard output.
-v Logs status messages to the console. (Stands for "verbose.")
-D name=value
Defines an automount environment variable by assigning value to the
variable.
-f master-file
Uses master-file for a list of initial directory to mapname pairs,
ahead of the auto.master NIS map. If an entry exists in both master-
file and auto.master, the one specified in master-file is used since it
is read first. Similarly, entries on the command line take precedence
over master-file entries. This technique can be used to replace
entries in global maps with your own.
-M mount-directory
Uses mount-directory instead of the default, /tmp_mnt.
-tl duration
Specifies a duration (in seconds) that a file system is to remain
mounted when not in use. The default is 5 minutes.
-tm interval
Specifies an interval (in seconds) between attempts to mount a file
system. The default is 30 seconds.
-tw interval
Specifies an interval (in seconds) between attempts to unmount file
systems that have exceeded their cached times. The default is 1 minute.
directory
Specifies the full pathname of a local directory if the map argument is
the name of an indirect map or the name of a special map. If the map
argument is the name of a direct map, the dummy directory "/-" is
specified as the directory.
map Names a map that the automount command uses to find the mount points
and locations. This can either be a file name, an NIS map name, or a
special map name.
-mount-options
Specifies the mount options to be applied to all of the directories
listed in map. If mount options are listed in the specified map, they
take precedence over these options.
DESCRIPTION
The automount daemon automatically and transparently mounts and unmounts
NFS file systems on an as-needed basis. It provides an alternative to
using /etc/fstab for NFS mounting file systems on client machines.
Note that the automount daemon will be retired in a future release of the
operating system. For information about migrating from Automount to its
replacement, AutoFS, see Network Administration: Services. For more
information about AutoFS, see autofsd(8).
The automount daemon can be started from the /etc/rc.config.common file or
from the command line. Once started, it sleeps until a user attempts to
access a directory that is associated with an automount map, or any
directory or file in the directory structure. The daemon awakes and
consults the appropriate map and mounts the NFS file system. By default,
the daemon mounts the remote file system under the directory /tmp_mnt and
creates a symbolic link to the temporary mount point. If the indicated
directory has not already been created, the daemon creates it and removes
it after automatic unmount. After a specified period of inactivity on a
file system, 5 minutes by default, the automount daemon unmounts that file
system.
The maps indicate where to find the file system to be mounted and the mount
options to use. The names of the maps are passed to automount from the
command line or from a master map. If the command line and the master map
contain contradictory arguments, the command line arguments take
precedence.
Note
The automount program reads the master map only at startup. If you
make any changes to the master map, you must restart automount.
An individual automount map is either local or served by NIS. A system,
however, can use both local and NIS automount maps. When a map is
referenced, the automount daemon checks whether a full pathname is
specified. If it is, automount looks for the designated mapname locally.
If the mapname is not a full pathname, automount looks for an NIS map by
that name.
By default, automount uses UDP. If the tcp option is specified in a map,
automount will try TCP. If TCP is not available, automount will then use
UDP.
Maps
Conventionally, automount maps are files that are located in the /etc
directory with names that have the prefix auto. They indicate which remote
file systems to mount, where to mount them, and which options to use.
The Master Map
The automount program can consult a master map, which contains entries that
point to other maps that can be either direct or indirect. If NIS is
running, automount checks for the presence of an NIS map named auto.master;
you are not required to run NIS or have an auto.master map. A master map
can also be a file whose location is specified with the -f command line
option.
The master map provides automount with a list of maps, and with arguments
that pertain to each of the maps. Each line in the master map has the
following syntax:
directory map [mount-options]
directory
Specifies the full pathname of a local directory if the map argument is
the name of an indirect map or the name of a special map. If the map
argument is the name of a direct map, the dummy directory "/-" is
specified as the directory.
map Names the map that the automount command uses to find the mount points
and locations. This can either be a file name, an NIS map name, or a
special map name.
mount-options
Lists the options used to regulate the mounting of entries listed in
map.
Direct Maps
Direct maps specify which remote file systems to mount locally and what the
local mount points are. They also can specify mount options. Direct maps
have the following syntax:
key [mount-options] location
key Specifies the full pathname of the mount point.
mount-options
Lists the options for this specific mount. When present, these options
override any mount options specified on the command line or in the
master map.
location
Specifies the location of the resource being mounted and uses the
format server:pathname. Multiple location fields can be specified; see
Replicated File Systems for more information.
Indirect Maps
Indirect maps have the same format as direct maps. However, unlike the key
in a direct map, the key in an indirect map is a simple name that does not
begin with a slash. (Remember that the indirect map as a whole has been
associated with a directory specified in the master map or on the command
line. The entries in an indirect map list subdirectories that are
individually mounted within the directory associated with the map.)
Special Maps
The -hosts map is a special automount map that is used to access all
directories exported by a server to a client.
The following command allows a client to access directories that are
exported from any host in its /etc/hosts file, the NIS hosts database:
# automount /net -hosts
For example, suppose that hera and sheba are both hosts on a local area
network that is running NIS. If superuser on hera enters the automount /net
-hosts command, users on hera can access any directories that sheba exports
to hera. All of the exported directories are mounted under /net/sheba on
hera.
The -null map, when indicated on the command line, cancels the map
associated with the directory indicated. It can be used to cancel a map
specified in the master map. For example, invoking the automount command
in the following manner causes the /net entry in auto.master to be ignored:
# automount /net -null
Pattern Matching
The ampersand (&) is expanded into the key field in a map wherever it
appears. In the following example, the ampersand (&) expands to oak:
#key mount_options location
#
oak &:/export/&
The asterisk (*), when supplied as the key field, is recognized as the
catch-all entry. It is used to substitute for lines that are all formatted
similarly. Any entry following the asterisk is ignored. In the following
example, the automount program uses the asterisk to match any host name
other than oak:
#key mount_options location
#
oak &:/export/&
* &:/home/&
Environment Variables
The value of an environment variable can be used within an automount map by
prefixing a dollar sign ($) to its name. You can also use braces to
delimit the name of the variable from appended letters or digits. The
environment variables can be inherited from the environment or can be
explicitly defined with the -D command line option.
Multiple Mounts
A multiple mount entry causes several NFS mount points to be mounted and
unmounted together. Multiple mounts have the following syntax:
key mountpoint [mount-options] location...\
[mountpoint [mount-options] location...] ...
key Specifies the full pathname or simple name of the mount point,
depending on whether it is a direct or indirect map entry.
mountpoint
Specifies the full pathname of a local directory. All mount points must
begin with a slash (/). A slash is acceptable as the first mountpoint.
mount-options
Lists the options for this specific mount. When present, these options
override any mount options specified on the command line or in the
master map.
location
Specifies the location of the resource being mounted and uses the
format server:pathname. Multiple location fields can be specified; see
Replicated File Systems for more information.
If multiple mounts are hierarchically related, the order in which they
appear in the entry is the order in which they are mounted.
In the following example, the directories /usr/local, /usr/local/bin,
/usr/local/src, and /usr/local/tools are mounted from the machines host1,
host2, host3, and host4, respectively. When the root of the hierarchy is
referenced, the automount program mounts the whole hierarchy.
/usr/local \
/ -ro host1:/usr/local \
/bin -ro host2:/usr/local/bin \
/src -ro host3:/usr/local/src \
/tools -ro host4:/usr/src/tools
Readability has been improved by splitting the entry into five lines and
indenting the continuation lines.
Shared Mounts
A shared mount prevents duplicate mounts of a remote file system by
creating symbolic links for subdirectories that the file system contains.
When you mount multiple directories from within a common remote directory,
you can specify the location field as follows:
host:path:subdir
host
Specifies the remote host from which to mount the file system.
path
Specifies a pathname for the common directory that contains the
directories you want to mount.
subdir
Specifies the name of a subdirectory to which you want to make a
symbolic link.
Suppose an indirect map called /auto.myindirect is specified in a master
file as follows:
/mydir /auto.myindirect
And the /auto.myindirect map consists of the following entries:
mybin host1:/usr/staff/diane:bin
mystuff host1:/usr/staff/diane:stuff
When a user accesses a file in /mydir/mybin, the automount daemon mounts
host1:/usr/staff/diane, but creates a symbolic link called /mydir/mybin to
the bin subdirectory in the temporarily mounted file system. If a user
immediately tries to access a file in /mydir/mystuff, the automount daemon
needs only to create a symbolic link that points to the stuff subdirectory
because the /usr/staff/diane directory is already mounted. With the
following map, the daemon would perform two separate mount operations:
mybin host1:/usr/staff/diane/bin
mystuff host1:/usr/staff/diane/stuff
Replicated File Systems
You can specify multiple locations for a single mount. If a file system is
located on several servers and one of the servers is disabled, the file
system can be mounted from one of the other servers. This makes sense only
when mounting a read-only file system.
In the following example, the reference pages can be mounted from host1,
machine2, or system3:
/usr/man\
-ro,soft host1:/usr/man \
machine2:/usr/man \
system3:/usr/man
The preceding example can also be expressed as a list of servers, separated
by commas and followed by a colon and the pathname, for example:
/usr/man -ro,soft host1,machine2,system3:/usr/man
This syntax is valid only if the pathname is the same on each server.
When you access the reference pages, the automount daemon issues a ping
(NFS v2 noop request) to each of the specified servers concurrently. The
server that first responds to the ping request is used for the mount.
NOTES
Sending the SIGTERM signal (kill -TERM) to the automount daemon causes it
to unmount all file systems that it has mounted, and to exit. This is the
preferred method. If you send any other signals that automount cannot
catch (for example, kill -KILL or kill -INT), any NFS mount points that
automount was not able to remove before exiting will hang. The hang will
occur from any program that attempts to access those mount points. You
must reboot the system in order to remove the NFS mount points.
Sending the SIGHUP signal to the automount daemon causes it to reread the
system mount table 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 system mount table.
RESTRICTIONS
Shell filename expansion does not apply to objects not currently mounted.
Because automount is singlethreaded, any request that is delayed by a slow
or nonresponding NFS server will delay all subsequent automount requests
until the delayed request has been completed.
EXAMPLES
1. The following is a sample auto.master map:
#
# mount-point mapname mount-options
#
/net -hosts
/home auto.indirect -rw
/- auto.direct -ro,intr
2. The following is a typical automount indirect map:
#
# key mount-options location
#
john merge:/usr/staff/john
mary stripe:/usr/staff/mary
fred blur:/usr/staff/fred
3. The following is a typical automount direct map:
#
# key mount-options location
#
/usr/source -ro merge:/usr/src/proto
/usr/local blur:/usr/bin/tools
4. The following is a sample indirect map that specifies multiple mount
locations for the file system reference. The file system is mounted
from the first server to respond to the mount request.
reference -ro earl:/usr/src/ref\
fern:/usr/staff/ron/ref\
irv:/usr/backup/reference
FILES
/tmp_mnt
Directory where automounted file systems reside.
SEE ALSO
Commands: autofsd(8), autofsmount(8), mount(8)
Network Administration: Services
 |
Index for Section 8 |
|
 |
Alphabetical listing for A |
|
 |
Top of page |
|