|
|
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 (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.
Since the name-to-location binding is dynamic, updates to an automount map are transparent to the user. This removes the need to pre-mount shared file systems for applications that have hardcoded references to files.
If you specify the dummy mount point ``/-'', 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 mount_point 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 Network Information Services map; if a file, the map argument must be a full pathname.
The -mount_options argument, when supplied, is a comma-separated list of NFS mount(ADM) options, preceded by a ``-''. If mount options are specified in the indicated map, however, those in the map take precedence.
If a reference needs to be protected from affixed characters, you can surround the variable name with curly braces.
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 NFS 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 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 file system may be accessed. With a map for /home such as:
able homeboy:/home/homeboy:able baker homeboy:/home/homeboy:bakerand 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 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/homeboy is already mounted. With the following map:
able homeboy:/home/homeboy/able baker homeboy:/home/homeboy/bakerautomount would have to mount the filesystem twice.
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.
able homeboy:/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 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:
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 loco:/usr/local alt:/usr/local \ /bin -ro,intr alt:/usr/local/bin loco:/usr/local/bin \ /man -ro,intr loco:/usr/local/man alt:/usr/local/manautomount would automatically mount /usr/local, /usr/local/bin and /usr/local/man, as needed, from either loco or alt, based on which host responded first.
mapname can either be a filename, or the name of a NIS map, or one of the special maps described below.
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.
The -passwd map uses the
passwd(F)
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.
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.
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 instance, given the command:
automount -f /etc/auto.master /home -null /- \/etc/auto.direct
and a file named /etc/auto.master that contains:
/homes -passwdautomount would mount home directories under /homes instead of /home, in addition to the various directories specified in the /etc/auto.direct file.
Since 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.