| United States-English |
|
|
|
![]() |
System Administration Commands: Section 1M (Ref Pages Vol 2) > aautomount(1M) |
|
NAMEautomount — automatically mount NFS file systems SYNOPSISautomount [-nTv] [-D name = value] [-f master-file] [-M mount-directory] [-tl duration] [-tm interval] [-tw interval] [directory map [-mount-options] ] ... DESCRIPTIONautomount is a daemon that automatically and transparently mounts NFS file systems 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. Maps can be assigned to a directory by using an entry in a direct automount map, or by specifying an indirect map on the command line. automount interacts with the kernel in a manner closely resembling an NFS server:
Since name-to-location binding is dynamic, updates to an automount map are transparent to the user. This obviates the need to mount shared file systems prior to running applications that contain internally hard-coded references to files. If the dummy directory (/-) is specified, 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 NIS/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 options to the mount command (see mount(1M)) preceded by a -. However, any conflicting mount options specified in the indicated map take precedence. Optionsautomount recognizes the following options:
Environment VariablesEnvironment variables can be used within an automount map. For example, if $HOME appears within a map, automount expands it to the current value of the HOME environment variable. To protect a reference from affixed characters, surround the variable name with curly braces. Environment variables cannot appear as the key entry in maps. EXAMPLESMap Entry FormatA 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 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 pings all servers in the list and then selects the first host that responds to serve that mount point. 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 might be accessed. Assume a map for /home resembling: mike hpserver1:/home/hpserver1:mike dianna hpserver1:/home/hpserver1:dianna Attempting to access a file in /home/mike causes automount to mount hpserver1:/home/hpserver1 and creates a symbolic link called /home/mike to the mike subdirectory in the temporarily-mounted filesystem. A subsequent file access request in /home/dianna results in automount simply creating a symbolic link that points to the dianna subdirectory because /home/hpserver1 is already mounted. Given the map: mike hpserver1:/home/hpserver1/mike dianna hpserver1:/home/hpserver1/dianna automount would have to mount the filesystem twice. A mapping can be continued across input lines by escaping the newline character with a backslash (\). Comments begin with a # and end at the subsequent newline character. Directory Pattern MatchingThe & character is expanded to the value of the directory field for the entry in which it occurs. Given an entry of the form: mike hpserver1:/home/hpserver1:& the & expands to mike. 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:
Hierarchical MappingsA 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,intr shasta:/usr/local ranier:/usr/local \ /bin -ro,intr ranier:/usr/local/bin shasta:/usr/local/bin \ /man -ro,intr shasta:/usr/local/man ranier:/usr/local/man automount automatically mounts /usr/local, /usr/local/bin, and /usr/local/man, as needed, from either shasta or ranier, whichever host responded first. Direct MapsA 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 MapsAn indirect map allows specifying mappings for the subdirectories to be mounted 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 MapsThe 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/NIS+ map, or one of the special maps described below. If mapname begins with a slash then it is assumed to be the pathname of a local file. Otherwise the location of the map is determined by the policy of the name service switch according to the entry for the automounter in /etc/nsswitch.conf, such as
If the name service is files then the name is assumed to be that of a local file in /etc. If the key being searched for is not found in the included map, the search continues with the next entry. Special MapsThree special maps, -hosts, -passwd, and -null, are currently available: The -hosts map uses the gethostbyname() map to locate a remote host when the hostname is specified (see gethostent(3C)). This map specifies mounts of all exported file systems from any host. For example, if the following automount command is already in effect: automount /net -hosts a reference to /net/hermes/usr initiates an automatic mount of all file systems from hermes that automount can mount, and any subsequent references to a directory under /net/hermes refer to the corresponding directory on hermes. The -passwd map uses the passwd(4) database to attempt to locate a user's home directory. For example, if the following automount command is already in effect: automount /homes -passwd 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 mounts the user's home directory as: /homes /username. For this map, the tilde character (~) is recognized as a synonym for 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 Mapautomount normally consults the auto_master 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. Maps given on the command line, or those given in a local master file specified with -f override those in the auto_master map. For example, given the command: automount /homes /etc/auto.homes /- /etc/auto.direct and the master map file auto_master containing: /homes -passwd automount mounts home directories using the /etc/auto.homes map instead of the special -passwd map in addition to the various directories specified in the /etc/auto.direct map. WARNINGSDo not send the SIGKILL signal (kill -9, or kill -KILL) to the automount daemon. Doing so causes any processes accessing mount directories served by automount to hang. A system reboot may be required to recover from this state. Do not start an automount daemon while another is still running. If restarting automount, make sure the first daemon and all of its children are not running. When automount receives signal SIGHUP, it rereads the /etc/mnttab file to update its internal record of currently mounted file systems. If a file system mounted by automount is unmounted by a umount command, automount should be forced to reread the file by sending the SIGHUP signal (see kill(1)). Shell file name expansion does not apply to objects not currently mounted. Since automount is single-threaded, any request that is delayed by a slow or nonresponding NFS server delays all subsequent automatic mount requests until it completes. Programs that read /etc/mnttab and then touch files that reside under automatic mount points introduce further entries to the file. Automatically-mounted file systems are mounted with type ignore; they do not appear in the output of either mount(1M), or bdf(1M). |
||||||||||||||||||||||||||||
|
|||||||||||||||