AUTOMOUNT(1M) AUTOMOUNT(1M) NAME automount - automatically mount NFS filesystems SYNOPSIS /usr/etc/automount [ -mnTv ] [ -D name=value ] [ -f master-file ] [ -p priority ] [ -M mount-directory ] [ -tl duration ] [ -tm interval ] [ -tp duration ] [ -tw interval ] [ directory mapname [ -mount-options ] ] ... DESCRIPTION Automount is a daemon that automatically and transparently mounts NFS filesystems as needed. Whenever a user on a client machine running automount invokes a command that needs to access a remote file or directory, the hierarchy to which that file or directory belongs is mounted and remains mounted for as long as it is needed. When a certain amount of time has elapsed during which the hierarchy is not accessed, it is automatically unmounted. No mounting of unaccessed remote filesystems is done at boot-time, and the user doesn't need special privilege to mount a directory. The automount daemon is started during system initialization from the /etc/init.d/network script if the configuration flags ``nfs'' and ``automount'' are set ``on.'' Do the following commands as super-user to enable automount: /etc/chkconfig nfs on /etc/chkconfig automount on Rebooting will start automount with the options and arguments contained in the file /etc/config/automount.options. The default version of this file lets you access exported directories on another host with the filename prefix of /hosts/<hostname>/ For example, if host springfield exports /usr, then ls /hosts/springfield/usr will show the contents of that directory. You may want to customize this file for your site. Unlike mount, automount does not consult the file /etc/fstab for a list of hierarchies to mount. Rather, it consults a series of maps, which can be either direct or indirect. The names of the maps can be passed to automount from the command line (via the /etc/config/automount.options file), or from another (master) map. The master map lists (as if from the command line) all other maps, applicable options, and mount points. 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 directory field consists of the basename of a subdirectory to be mounted as needed. 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. automount appears to be an NFS server to the kernel. automount uses the map contained in the mapname argument to locate an appropriate NFS file server, exported filesystem, and mount options. It then mounts the filesystem in a temporary location, and creates 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 has not already been created, the daemon creates it, and then removes it upon exiting. By default, automount mounts everything under the directory /tmp_mnt. For instance, if a user wants to mount a remote directory src under /usr/src, the actual mount point will be /tmp_mnt/usr/src, and /usr/src will be a symbolic link to that location. As with any other kind of mount, a mount effected through the automounter on a non-empty mount point will hide the original contents of the mount point for as long as the mount is in effect. 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. Nor is there a need to maintain records of which hosts must be mounted for what applications. If the directory 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. If the directory argument is `/-', 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. A map can be a file or a network information service (NIS) map; if a file, the map argument must be a full pathname. The -mount-options argument, when supplied, consists of the leading dash and a comma-separated list of options to mount(1M), as described in fstab(4). If these options are supplied, they become the default mount options for all entries in the map. Mount options provided within a map entry override these defaults. OPTIONS -D var=value Assign value to the indicated automount (environment) variable. -f master-file Read a local file for initialization, before reading the auto.master NIS map. The information in master-file will take precedence. -m Suppress initialization of directory-mapname pairs listed in the auto.master NIS database. -M mount-directory Mount temporary filesystems in the named directory, instead of /tmp_mnt. -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 standard error. -p priority Set the (non-degrading) priority of the automount process. The default is NDPNORMAX (40). -tl duration Specify a duration, in seconds, that a filesystem is to remain mounted when not in use. The default is 300 seconds (5 minutes). -tm interval Specify an interval, in seconds, between attempts to mount a filesystem. The default is 30 seconds. -tp duration Specify the duration, in seconds, that the results of a probe of a server's availability will remain cached. The default is 5 seconds. -tw interval Specify an interval, in seconds, between attempts to unmount filesystems that have exceeded their cached times. The default is 60 seconds. -v Verbose. Log status and/or warning messages through syslog(3B) or to the console. ENVIRONMENT 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. Environment variables are expanded only for the automounter's environment - not for the environment of a user using the automounter's services. If a variable 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 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 options to mount(1M), as described in fstab(4), and location specifies a remote filesystem from which the directory may be mounted. In the simple case, location takes the form: hostname:pathname Replicated Filesystems Multiple location fields can be specified for replicated read-only filesystems, 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. Since automount does not monitor the status of the server while the filesystem is mounted, it will not use another location in the list if the currently mounted server crashes. This support for replicated filesystems is available only at mount time. Once unmounted, another location may be used for subsequent mounts of the filesystem. If each location in the list shares the same pathname then a single location may be used with a comma-separated list of hostnames: hostname1,hostname2:pathname Sharing Mounts If location is specified in the form: hostname:pathname:subdir hostname is the name of the server from which to mount the filesystem, pathname 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 an indirect map for /home such as: bart springfield:/home/simpsons:bart maggie springfield:/home/simpsons:maggie and a user attempting to access a file in /home/bart, automount mounts springfield:/home/simpsons, but creates a symbolic link called /home/bart to the bart subdirectory in the temporarily-mounted filesystem. If a user immediately tries to access a file in /home/maggie, automount needs only to create a symbolic link that points to the maggie subdirectory; /home/simpsons is already mounted. With the following map: bart springfield:/home/simpsons/bart maggie springfield:/home/simpsons/maggie automount would have to mount the filesystem twice. Comments and Quoting 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. Characters that have special significance to the automount map parser may be protected either with double quotes (") or by escaping with a backslash (\). Pathnames with embedded whitespace, colons (:) or dollars ($) should be protected. Directory Pattern Matching The `&' character is expanded to the value of the directory field for the entry in which it occurs. In this case: bart springfield:/home/simpsons:& the & expands to bart. The `*' character, when supplied as the directory field, is recognized as the catch-all entry. Such an entry will be used if any previous entry has not successfully matched the key being searched for. For instance, if the following entry appeared in the indirect map for /home: * &:/home/& this would allow automatic mounts in /home of any remote filesystem whose location could be specified as: hostname:/home/hostname Multiple Mounts A multiple mount entry takes the form: directory [ /[ subdirectory [ -mount-options ] location ... ] ... The initial / preceding the subdirectory is required; the optional subdirectory is taken as a pathname relative to the directory. If subdirectory is omitted in the first occurrence, the / refers to the directory itself. Given the direct map entry: /tools \ / -ro dill:/tools mint:/tools \ /1.0 -ro mint:/tools/1.0 dill:/tools/1.0 \ /1.0/man -ro dill:/tools/1.0/man mint:/tools/1.0/man automount would automatically mount /tools, /tools/1.0 and /tools/1.0/man, as needed, from either dill or mint, whichever host responded first. If the mounts are hierarchically related, mounts closer to the root must appear before submounts. All the mounts of a multiple mount entry will occur together and will be unmounted together. This is important if the filesystems reference each other with relative symbolic links. Multiple mount entries can be used both in direct maps and in indirect maps. 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 filename, or the name of an NIS map, or one of the special maps described below. If the directory being searched for is not located in an included map, the search continues with the next entry. Special Maps There are two special maps currently available: -hosts and -null. The -hosts map uses the NIS hosts.byname map 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 /hosts -hosts then a reference to /hosts/springfield/usr would initiate an automatic mount of all filesystems from springfield that automount can mount; references to a directory under /hosts/springfield will refer to the corresponding directory relative to springfield's root. The -null map, when indicated on the command line, cancels any subsequent map for the directory indicated. It can be used to cancel a map given in auto.master or for a mount point specified as an entry in a direct map. 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 over a local -f master map and they both take precedence over an NIS auto.master map. This configuration database contains arguments to the automount command, rather than mappings; unless -f is in effect, automount does not look for an auto.master file on the local host. 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 auto.home automount would mount home directories under /homes instead of /home, in addition to the various directories specified in the /etc/auto.direct file. FILES /tmp_mnt directory under which filesystems are dynamically mounted /etc/config/automount.options site-dependent options and arguments SEE ALSO mount(1M), network(1M), chkconfig(1M), fstab(4), exports(4), schedctl(2) NOTES The -hosts map mounts all of the exported filesystems, for which the client has access, from a server. Use of the nohide export option on the server (see exports(4)) may be used to minimize the number of mounts performed by clients. Automount will not request a separate mount for a nohide filesystem, if the client has access via the parent filesystem. 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/mtab file to update its internal record of currently-mounted filesystems. If a filesystem mounted with automount is unmounted with the umount(1M) command, automount should be forced to reread the file by using the command /etc/killall -HUP automount An ls(1) listing of the entries in the directory for an indirect map shows only the symbolic links for currently mounted filesystems. This restriction is intended to avoid unnecessary mounts as a side effect of programs that read the directory and stat(2) each of the names. Mount points for a single automounter must not be hierarchically related. automount will not allow an automount mount point to be created within an automounted filesystem. The recommended way to terminate automount services is to send a SIGTERM signal to the daemon: /etc/killall -TERM automount 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. automount must not be terminated with the SIGKILL signal. Without an opportunity to unmount itself, the automount mount points will appear to the kernel to belong to a non-responding NFS server. Since each direct map entry results in a separate mount for the mount daemon, such maps should be kept short. Although both direct and indirect maps can be modified at any time, entries added to a direct map will have no effect until the automounter is restarted. Automount mount points are mounted with type ignore; they do not appear in the output of either mount(1M) or df(1). Automatically-mounted filesystems, on the other hand, are mounted with type nfs and are reported along with other NFS-mounted filesystems. BUGS Shell filename expansion does not apply to objects not currently mounted. The bg mount option is not recognized by the automounter. 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/mtab and then touch files that reside under automatic mount points will introduce further entries to the file. Page 8