Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > A


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


automount — install automatic mount points


/usr/sbin/automount [-f master-file] [-t duration] [-v]


The automount command installs autofs mount points and associates an automount map with each mount point. The autofs filesystem monitors attempts to access directories within it and notifies the automountd daemon (see automountd(1M)). The daemon uses the map to locate a filesystem, which it then mounts at the point of reference within the autofs filesystem. You can assign a map to an autofs mount using an entry in the /etc/auto_master map or a direct map.

If the filesystem is not accessed within an appropriate interval (10 minutes by default), the automountd daemon unmounts the file system.

The file /etc/auto_master determines the locations of all autofs mount points. By default, this file contains the following entry:

# Master map for automounter # /net -hosts -nosuid,soft,nobrowse

The first field in the master file specifies a directory on which an autofs mount will be made, and the second field specifies the automounter map to be associated with it. Mount options may be supplied as an optional third field in the entry. These options are used for any entries in the map that do not specify mount options explicitly. The automount command is usually run without arguments. It compares the entries /etc/auto_master with the current list of autofs mounts in /etc/mnttab and adds, removes, or updates autofs mounts to bring the /etc/mnttab up to date with the /etc/auto_master. At boot time, it installs all autofs mounts from the master map. Subsequently, it may be run to install autofs mounts for new entries in the master map or a direct map, or to perform unmounts for entries that have been removed.

If the first field specifies the directory as /-, automount treats the second field 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 first field is a path name, the second field names an indirect map or a special map (described below). An indirect map contains a list of the subdirectories within the indicated directory. With an indirect map, it is these subdirectories that are mounted automatically.

The automounter maps, including the auto_master map, may be distributed by NIS or LDAP. The Name Service Switch configuration file, /etc/nsswitch.conf, determines where the automount command will look for the maps.


automount recognizes the following options:

-f master-file

Specify a local master file for initialization.

When the -f option is used and the master file specified is not found, then automount defaults to /etc/auto_master and then to the NIS auto_master map.

-t duration

Specify a duration, in seconds, that a file system is to remain mounted when not in use. The default is 600 (10 minutes). The new duration value will apply to new autofs mount points and their associated autofs mounts. Note that setting a new duration does not affect any existing autofs mount points or associated autofs mounts. In order for the new duration to take effect, an existing autofs mount point must first be unmounted, then remounted.


Verbose mode. Notify of autofs mounts, unmounts, or other non-essential information. Messages are written to standard error.

Map Entry Format

A simple map entry (mapping) takes the form:

key [-mount-options] location...

where key is the full path name of the directory to mount when used in a direct map, or the simple name of a subdirectory in an indirect map. mount-options is a comma-separated list of mount options, and location specifies a file system from which the directory may be mounted. In the case of a simple NFS mount, the options that can be used are as specified in mount_nfs(1M), and location takes the form:


host is the name of the host from which to mount the file system and pathname is the path name of the directory to mount.

Default mount options can be assigned to an entire map when specified as an optional third field in the master map. These options apply only to map entries that have no mount options.

Replicated Filesystems

Multiple location fields can be specified for replicated NFS filesystems, in which case the information is used to try to increase availability. The server chosen for the mount is the one with the strongest preference based on a sorting order. Note that autofs does not monitor the status of mounts when dealing with replicated filesystems and does not select alternate servers.

The sorting order used gives strongest preference to servers on the same local subnet with servers on the local net given the second strongest preference. Among servers equally far away, response times will determine the order if no weighting factors are used (see below).

If the list of locations contains some servers using the NFS Version 2 Protocol and some servers using the NFS Version 3 Protocol, then automount will choose a subset of the list having only servers with the same protocol. This subset is formed of servers using the NFS Version 3 Protocol unless there are no such servers on the list or there is a server using the NFS Version 2 Protocol that has the strongest preference as described previously.

If each location in the list shares the same pathname then a single location may be used with a comma-separated list of hostnames:


Requests for a server may be weighted, with the weighting factor appended to the server name as an integer in parentheses. Servers without a weighting default to a value of zero (most likely to be selected). Progressively higher values decrease the chance of being selected. In the example,

man -ro alpha,bravo,charlie(1),delta(4):/usr/share/man

hosts alpha and bravo have the highest priority; host delta has the lowest priority.


Server proximity takes priority in the selection process. In the example above, if the server delta is on the same network segment as the client, but the others are on different network segments, then delta will be selected; the weighting value is ignored. The weighting has effect only when selecting between servers with the same network proximity.

In cases where each server has a different export point, you can still apply the weighting. For example:

man -ro alpha:/usr/man bravo,charlie(1):/usr/share/man \ delta(3):/export/man

A mapping can be continued across input lines by escaping the newline with a backslash (\). Comments begin with a number sign (#) and end at the subsequent newline.

Map Key Substitution

The ampersand (&) character is expanded to the value of the key field for the entry in which it occurs. In this case:

amy rowboatserver:/home/&

the & expands to amy.

Wildcard Key

The asterisk (*) character, when supplied as the key field, is recognized as the catch-all entry. Such an entry will match any key not previously matched. For instance, if the following entry appeared in the indirect map for /config:

* &:/export/config/&

it would allow automatic mounts in /config of any remote file system whose location could be specified as:


Variable Substitution

Client specific variables can be used within an automount map. For instance, if $HOST appeared within a map, automount would expand it to its current value for the client's host name. Supported variables are:


The processor type. The possible values are: IA64, PA10, PA11, PA20.


The output of uname -n. The host name. For example, rowboat.


The output of uname -s. The OS name. For example, HP-UX.


The output of uname -r. The OS release name. For example, B.11.00.


The output of uname -v. The OS version. For example, C.

If a reference needs to be protected from neighboring characters, you can surround the variable name with braces ({}).

Multiple Mounts

A multiple mount entry takes the form:

  • key [- mount-options] [[mountpoint] [- mount-options] location]...

The initial /[mountpoint] is optional for the first mount and mandatory for all subsequent mounts. The optional mountpoint is taken as a path name relative to the directory named by key. If mountpoint is omitted in the first occurrence, a mountpoint of / (root) is implied.

Given an entry in the indirect map for /src:

beta -ro \ / svr1,svr2:/export/src/beta \ /1.0 svr1,svr2:/export/src/beta/1.0 \ /1.0/man svr1,svr2:/export/src/beta/1.0/man

All offsets must already exist on the server under beta. automount would automatically mount /src/beta, /src/beta/1.0, and /src/beta/1.0/man, as needed, from either svr1 or svr2, whichever host is nearest and responds first.

The autofs mount points must not be hierarchically related. automount does not allow an autofs mount point to be created within another autofs mount.

Other Filesystem Types

The automounter assumes NFS mounts as a default filesystem type. Other filesystem types can be described using the -fstype mount option. Other mount options specific to this filesystem type can be combined with the -fstype option. The location field must contain information specific to the filesystem type. If the location field begins with a slash, a colon character must be prepended, for instance, to mount a CD filesystem:

cdrom -fstype=hsfs,ro :/dev/sr0

or to perform an autofs mount:

src -fstype=autofs auto_src

Mounts using CacheFS are most useful when applied to an entire map as map defaults (see cfsadmin(1M)). The following entry in the master map describes cached home directory mounts. It assumes the default location of the cache directory, /cache.

/home auto_home -fstype=cachefs,backfstype=nfs

Indirect Maps

An indirect map allows you to specify mappings for the subdirectories you wish to mount under the directory indicated in the /etc/auto_master map. In an indirect map, each key consists of a simple name that refers to the subdirectory of one or more filesystems that are to be mounted as needed.

Entries in both direct and indirect maps can be modified at any time. The new information is used when automountd next uses the map entry to do a mount.

Direct Maps

Entries in a direct map are associated directly with autofs mount points. Each key is the full path name of an autofs mount point. The direct map as a whole is not associated with any single directory.

Since each direct map entry results in a new autofs mount, such maps should be kept short.

If a directory contains direct map mount points, then an ls -l in the directory will force all the direct map mounts to occur.

Entries in both direct and indirect maps can be modified at any time. The new information is used when automountd next uses the map entry to do a mount.

New entries added to a master map or direct map will not be useful until the automount command is run to install them as new autofs mount points. New entries added to an indirect map may be used immediately.

Included Maps

The contents of another map can be included within a map with an entry of the form:


If mapname begins with a slash then it is assumed to be the path name 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

automount: nis files

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 Maps

There are two special maps available: -hosts and -null. The -hosts map is used with the /net directory and assumes that the map key is the hostname of an NFS server. The automountd daemon dynamically constructs a map entry from the server's list of exported filesystems. References to a directory under /net/hermes will refer to the corresponding directory relative to hermes root.

The -null map cancels a map for the directory indicated. This is most useful in the /etc/auto_master map for cancelling entries that would otherwise be inherited from the +auto_master include entry. To be effective, the -null entries must be inserted before the included map entry.

Executable Maps

Local maps that have the execute bit set in their file permissions will be executed by the automounter and provided with a key to be looked up as an argument. The executable map is expected to return the content of an automounter map entry on its standard output or no output if the entry cannot be determined. A direct map cannot be made executable.

Configuration and the auto_master Map

When initiated without arguments, automount consults the master map for a list of autofs mount points and their maps. It mounts any autofs mounts that are not already mounted, and unmounts autofs mounts that have been removed from the master map or direct map.

The master map is assumed to be called auto_master and its location is determined by the name service switch policy. Normally the master map is located initially as a local file, /etc/auto_master.


Browsing of indirect maps allows all of the potential mount points to be visible for that map regardless of whether they are mounted or not. The -nobrowse option can be added to any indirect autofs map to disable browsing. For example:

/net -hosts -nosuid,soft,nobrowse

In this case, any host names would only be visible in /net after they are mounted. The -browse option enables browsing of autofs file systems. This is the default for all indirect maps, although it is suggested that the -hosts entry contain the -nobrowse option.

Note that, although a listing of the autofs directory associated with an indirect map shows all potential mountable entries, the attributes associated with those entries are temporary until the actual filesystem attributes can be retrieved once the filesystem has been mounted.

Network Information Service (NIS) and Yellow Pages (YP)

The Network Information Service (NIS) was formerly known as Sun Yellow Pages (YP). The functionality of the two remains the same.


automount returns the following values:






Map not found.


automount was developed by Sun Microsystems, Inc.



Master automount map.


Name service switch configuration file.


autofs automount command.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.