Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ automnt(NADM) — OpenDesktop 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mount(ADM)

df(C)

passwd(C)


 automount(NADM)                 19 June 1992                 automount(NADM)


 Name

    automount - automatically mount NFS filesystems

 Syntax

    automount [-mnTv] [ -D name=value ] [ -f master-file ] [ -M mount-
    directory ] [ -tl duration ] [ -tm interval ] [ -tw interval ] [
    directorymap [ -mount-options ] ] ...

 Description

    automount is a daemon that automatically and transparently mounts an NFS
    file system 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.  You can assign a map to a directory
    using an entry in a direct automount map, or by specifying an indirect
    map on the command line.

    The automount daemon appears to be an NFS server to the kernel.  auto-
    mount uses the map to locate an appropriate NFS file server, exported
    file system, and mount options.  It then mounts the file system in a tem-
    porary 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 dae-
    mon 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 obviates the need to ``pre-mount''
    shared file systems for applications that have ``hard-coded'' references
    to files.

    If you specify the dummy directory ``/-'', automount treats the map argu-
    ment 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 directory argument is a pathname, the map argument points to an
    indirect map.  An indirect map contains a list of the subdirectories con-
    tained 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 speci-
    fied in the indicated map, however, those in the map take precedence.

 Options


    -m   suppress initialization of directory-map pairs listed in the
         auto.master Network Information Services database

    -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.  This option expands each NFS call and displays it on the
         standard output.

    -v   verbose.  This option logs status messages to the console.

    -D envar=value
         assign value to the indicated automount (environment) variable

    -f master-file
         read a local file for initialization, ahead of the auto.master NIS
         map

    -M mount-directory
         mount temporary filesystems in the named directory, instead of
         /tmp_mnt

    -tl duration
         specify a duration, in seconds, that a file system is to remain
         mounted when not in use.  The default is 300 seconds.

    -tm interval
         specify an interval, in seconds, between attempts to mount a file-
         system. The default is 30 seconds.

    -tw interval
         specify an interval, in seconds, between attempts to unmount file-
         systems that have exceeded their cached times.  The default is 60
         seconds.

 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.

    If a 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 NFS mount options, and loca-
    tion 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:baker

    and 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/baker

    automount 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.

    Directory pattern matching

    The ``&'' character is expanded to the value of the directory field for
    the entry in which it occurs.   In this case:


       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 previ-
    ously 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:


       hostname :/home/ hostname


    Hierarchical mappings

    A hierarchical mapping takes the form:


       directory [ /mount-options ] location ...  ] ...

    The initial ``/'' within the `/[subdirectory]' is required; the optional
    subdirectory is taken as a filename relative to the directory.  If sub-
    directory is omitted in the first occurrence, the ``/'' refers to the
    directory itself.


    Given the direct map entry:


    /usr/local   \
            /       -ro,       loco:/usr/local              alt:/usr/local   \
            /bin    -ro,       alt:/usr/local/bin   loco:/usr/local/bin   \
            /man    -ro,       loco:/usr/local/man  alt:/usr/local/man


    automount 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.


    Direct maps

    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.


    Indirect maps

    An indirect map allows you to specify mappings for the subdirectories you
    wish to mount 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 sub-
    directory to be mounted as needed.


    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 a NIS map, or one of the
    special maps described below.

    Special maps

    There are three special maps currently available:  -hosts, -passwd and
    -null.  The -hosts map uses the hostname resolution facilities available
    on the system 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  /net  -hosts

    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(C) 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, auto-
    mount 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.

    Configuration and the auto.master map

    automount normally consults the auto.master Network Information Services
    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; 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  -passwd

    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/auto.master    list of master NIS configuration maps

    /etc/auto.direct    list of direct automounter maps

    /etc/auto.indirect  list of indirect automounter maps

 See also

    mount(ADM), df(C), passwd(C)

 Notes

    When it receives signal number 1, SIGHUP, automount rereads the
    /etc/mnttab file to update its internal record of currently mounted file
    systems.  If a file system mounted with automount is unmounted by a
    umount(ADM) command, automount should be forced to reread the file.

 Bugs

    Shell filename expansion does not apply to objects not currently mounted.

    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.


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026