From: curt@aixwiz.austin.ibm.com (Curt Finch/131072)
Newsgroups: comp.unix.aix
Subject: repost: automounter docs.
Date: 12 Oct 92 16:30:44 GMT
Reply-To: curt@aixwiz.austin.ibm.com (Curt Finch/131072)
Organization: IBM AWD, Austin, TX





automount Daemon

Purpose

Mounts NFS file systems automatically.

 Syntax

/usr/sbin/automount  [  -m  -n  -T  -v  ] [  -D  name=value ] [   -f
MasterFile  ] [  -M  MountDirectory ] [  -tl  Duration ] [   -tm
Interval ] [   -tw Interval ] Directory ... MapName ...   [
-MountOption [  ,MountOption ] ... ]

Description

The automount  daemon automatically and transparently mounts an NFS
file system whenever a file or directory in that file system is
opened.  The automount daemon forks a child process daemon, which
appears as an NFS server to the client.  The forked daemon monitors
attempts to access file systems that are associated with an automount
map.  When a file is accessed, the daemon mounts the appropriate NFS
directory.  A map is assigned to a directory either by using an entry
in a direct automount map, or by specifying an indirect map on the
command line.

Maps

The automount  daemon uses maps to locate an appropriate NFS file
server and exported file system, and to determine mount options.  The
daemon mounts the file system in a temporary location, creating a
symbolic link to the temporary location.  If the file system is not
accessed within a given 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 first
creates it, then removes the directory upon exiting.

A map can be a file or a Network Information Service (NIS ) map.  If a
file is supplied, the map argument must be a full path name.

If the directory argument supplied to the automount daemon is a path
name, the map argument must be an indirect map.  In an indirect map,
the key for each entry is a simple name that represents a symbolic link
in a directory to an NFS mount point.

If the directory argument is /- (slash, minus), the map that follows
must be a direct map.  A direct map is not associated with a single
directory.  Instead, the key for each entry is a full path name that
serves as a symbolic link to an NFS mount point.

Updates to an automount map are transparent to the users because
name-to-location binding is dynamic.  This process eliminates the need
to pre-mount shared file systems for applications containing hard-coded
references to files.

See   "How to Manage NIS automount Maps" for more information about
formatting map entries, multiple mounts, special maps, and the
auto.master NIS configuration map file.

Mounts

Warning: Do not terminate the automount daemon with the kill -9
command.  This procedure does not permit the daemon to unmount itself,
which causes the kernel to interpret automount mounts as an NFS server
that is not responding.  Terminate automount services by sending the
kill -15 command to the daemon.  This method allows the automounter to
first receive the signal, then unmount its daemon and evaluate any
mount points in the /tmp_mnt file.  Mounts in the /tmp_mnt file that
are busy will not be unmounted.

The -MountOptions argument is a list of mount options.  The list is
preceded by a - (minus sign), and each option is separated by a comma.
If this argument is supplied, the options usually become the default
mount options for all entries in the map.

Notes:

1. Mount options provided in a map entry override the -MountOptions
argument.

2. The   mount command's bg background mount option is not recognized
by the automount daemon.

The automount  daemon is single-threaded.  Any request delayed by a
slow or unresponsive NFS server delays all subsequent automatic mount
requests until the initial request completes.  Programs that read the
/etc/mtab file and then touch files that reside under automatic mount
points introduce further entries to the file.  Automatically mounted
file systems are mounted with the mount command's -t  type option set
equal to ignore.  These file systems do not appear in the output of
either the mount command or the   df command.

Environment Variables

Environment variables, specific only to the automount daemon, can be
used in an automount map.  When the daemon encounters an automount
variable, the environment expands to account for the new variable.
Environment variables are valid only for the automounter's environment,
not for the operating system's environment.

References can be protected from affixed characters by enclosing the
variable name in { } (curly braces).

Note: Some NFS servers support mount options not supported by the AIX:
grpid, noauto , remount, quota, noquota, posix, nocto, and noac. By
default, the AIX version of the automount  daemon ignores these listed
options.  To reverse the effect of this default, use the
AUTOMOUNT_BAD_OPTS  shell environment variable.

Configuration

The automount daemon normally consults the auto.master  NIS
configuration map for a list of initial Directory-to-MapName pairs, and
sets up automatic mounts for them in addition to those given on the
command line.  If there are duplications, the command-line parameters
take precedence.

Note: This map contains the automount daemon parameter.  The automount
daemon does not look for an auto.master file on the local host.

See   "How to Manage NIS automount Maps" for more information about
configuring the auto.master NIS map file.

Flags

-Denvar =value Assigns a value to the indicated automount command
environment variable.

-f MasterFile Reads the named local file, rather than the auto.master
NIS map file, for initialization.

-m  Suppresses initialization of directory-mapname pairs listed in the
auto.master NIS database.

The automount  daemon is single-threaded.  Any request delayed by a
slow or unresponsive NFS server delays all subsequent automatic mount
requests until the initial request completes.  Programs that read the
/etc/mtab file and then touch files that reside under automatic mount
points introduce further entries to the file.  Automatically mounted
file systems are mounted with the mount command's -t  type option set
equal to ignore.  These file systems do not appear in the output of
either the mount command or the   df command.

Environment Variables

Environment variables, specific only to the automount daemon, can be
used in an automount map.  When the daemon encounters an automount
variable, the environment expands to account for the new variable.
Environment variables are valid only for the automounter's environment,
not for the operating system's environment.

References can be protected from affixed characters by enclosing the
variable name in { } (curly braces).

Note: Some NFS servers support mount options not supported by the AIX:
grpid, noauto , remount, quota, noquota, posix, nocto, and noac. By
default, the AIX version of the automount  daemon ignores these listed
options.  To reverse the effect of this default, use the
AUTOMOUNT_BAD_OPTS  shell environment variable.

Configuration

The automount daemon normally consults the auto.master  NIS
configuration map for a list of initial Directory-to-MapName pairs, and
sets up automatic mounts for them in addition to those given on the
command line.  If there are duplications, the command-line parameters
take precedence.

Note: This map contains the automount daemon parameter.  The automount
daemon does not look for an auto.master file on the local host.

See   "How to Manage NIS automount Maps" for more information about
configuring the auto.master NIS map file.

Flags

-Denvar =value Assigns a value to the indicated automount command
environment variable.

-f MasterFile Reads the named local file, rather than the auto.master
NIS map file, for initialization.

-m  Suppresses initialization of directory-mapname pairs listed in the
auto.master NIS database.

________________________________________________________________________

How to Manage NIS automount Maps

Prerequisite Tasks or Conditions

1. NFS must be installed on your system.

2. TCP/IP must be running.

3. The master server and slave servers must be configured.

Procedure

1. Edit the /etc/auto.master file.  The   automount daemon, by default,
reads the NIS /etc/auto.master map to find which directories to watch
for mounts.  The auto.master  map has the following format:

DirectoryPath     AutomountMapName

The AutomountMapName  filed specifies a file containing the automount
map for the directory specified by the DirectoryPath field.  For
example, the contents of the /etc/auto.master file on the NIS server
might be as follows:

/home/home     /etc/auto.home /usr/lpp       /etc/auto.direct

The above auto.master  file entries will direct the automount  daemon
to use the /etc/auto.home automount map for the /home/home  directory
and the /etc/auto.direct automount map for the /usr/lpp  directory.

2. Create the AutomountMapName files.  The AutomountMapName files have
the following format:

Subdirectory   MountOptions   ServerName:ServerDirectory

The Subdirectory  field specifies a subdirectory of the DirectoryPath
field directory of the auto.master file.  For example, the contents of
the /etc/auto.home file on the NIS client might be as follows:

john  -rw,hard,intr host1:/home/john bill  -rw,hard,intr
host3:/home/bill sally  -rw,hard,intr host5:/home/sally fred
-rw,hard,intr host9:/home/fred jane  -rw,hard,intr host1:/home/jane

The contents of the /etc/auto.direct file on the NIS client might be as
follows:

X11 -ro,hard,intr lppserver:/usr/lpp/X11 bsmEn_US -ro,hard,intr
lppserver:/usr/lpp/bsmEn_US gnuemacs -ro,hard,intr
lppserver:/usr/lpp/gnuemacs info -ro,hard,intr lppserver:/usr/lpp/info

3. Update the /var/yp/Makefile file.  The following must be added to
the Makefile file:

z Add auto.master to the all: listing.

z Add an entry for $(DIR)/auto.master: at the appropriate point in the
file.

z Add the following stanza to the Makefile file:

auto.master.time: $(DIR)/auto.master
 -@if [ -f $(DIR)/auto.master ] ; then \
  $(MAKEDBM) $(DIR)/auto.master $(YPDBDIR)/$(DOM)/auto.master; \ touch
  auto.master.time ; \ echo "updated auto.master" ; \ if [ ! $(NOPUSH)
  ] ; then \
   $(YPPUSH) auto.master ; \ echo "pushed auto.master" ; \ else \
   : ; \ fi \ else \
  echo "couldn't find $(DIR)/auto.master" ; \ fi

In general, the same format that is used for the netmasks entry in the
Makefile file can be used for the auto.master entry.

4. Build the auto.master map by executing the following command:

make auto.master

If errors are generated, check for improper configuration of NIS,
errors in the Makefile file, or errors in the syntax of the
/etc/auto.master file.

5. Start the automount daemon by executing the following command:

/usr/sbin/automount

This starts the automount daemon, which reads the auto.master NIS map.

In the examples above, when these procedures are completed, a user on
the client can issue the cd /home/home/bill command and have the
/home/bill directory mounted from the host3 system onto the
/home/home/bill directory.  The same is true if the info command is
executed.  The /usr/lpp/info directory will be mounted from the
lppserver system onto the /usr/lpp/info directory on the client and the
info command will be executed from the mounted directory.

Maintaining All of the automount Maps with NIS

In the example above, the /etc/auto.home and /etc/auto.direct  were
local files on the client that contained all of the automount map
needed.  The contents of the automount maps can also be maintained by
NIS.  The files would still exist on the client, but the contents would
be different.  For example, the /etc/auto.home  file would contain the
following:


+auto.home

And the /etc/auto.direct file would contain the following:

+auto.direct

This directs the automount daemon to consult the NIS maps auto.home and
auto.direct when it reads the local files.  The NIS server would
contain two new NIS maps.  The maps would be auto.home and auto.direct.
They would be added to the /var/yp/Makefile in the same way that the
auto.master NIS map was added.  This makes them available for use by
the NIS clients running the automount daemon.

This facility can also be used to define local portions of the
automount maps and then refer to the NIS maps for the rest of the
automount map.  For example, the /etc/auto.home file could contain the
following:

sandy  -rw,hard,intr  host10:/home/sandy james  -rw,hard,intr
host2:/home/james bill  -rw,hard,intr  host20:/home/bill +auto.home

This automount  map has three local entries and then it contains the
NIS map auto.home. This way, local definitions can be maintained while
taking advantage of the NIS map for the /home/home directory.  The
entry bill in the local map would appear in the auto.home NIS map.  The
local map entry will override the NIS map entry.

Defect 48974, added the following, 03-23-92, Century Design, 343-4322.

Using automount Maps

The use of automount  maps involves map formats, replicated file
systems, shared mounts, comments in maps, directory patterns, multiple
mounts, included maps, maps for the automount command, and the
auto.master map file.

Map Entry Format

A simple map entry (mapping) follows:

key [-mount-options] location ...

The key is the full path name of the directory to mount when used in a
direct map.  In an indirect map, key represents a simple name.  The
mount-options is a list separated by commas.  The location specifies a
remote file system from which the directory can be mounted.  In the
example case, location takes the form:

hostname:pathname

Replicated File Systems

Multiple location fields can be specified for replicated read-only file
systems, in which case automount sends multiple mount requests;
automount mounts the file system from the first host that replies to
the mount request.  This initial request goes 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
file system is mounted, it will not use another location in the list if
the currently mounted server crashes.  This support for replicated file
systems is available only at mount time.

If each location in the list shares the same path name, a single
location can be used with a list of host names, separated by commas.

hostname,hostname...:pathname

Sharing Mounts

The following is an example location entry.

hostname:pathname:subdir

The hostname is the server name where the file system will mount,
pathname is the directory path to mount, and subdir, when supplied, is
where the symbolic link is made to a subdirectory.  This can be used to
prevent duplicate mounts when multiple directories in the same remote
file system can be accessed.  For example, consider the following map
for /home:

able prime:/home/prime:able

baker prime:/home/prime:baker

When a user attempts to access a file in /home/able, the automount
command mounts prime:/home/prime, but creates a symbolic link called
/home/able  to the able subdirectory in the temporarily-mounted file
system.  If a user immediately tries to access a file in /home/baker ,
the automount command creates a symbolic link that points to the baker
subdirectory.  The /home/prime directory would already be mounted.

With the following map, automount would have to mount the file system
twice.

able prime:/home/prime/able

baker prime:/home/prime/baker

Comments and Quoting

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

Characters that have special significance to the automount map parser
may be protected either with " (double quotation marks) or by escaping
with a \ (backslash).  For example, path names with embedded
whitespace, : (colon), or $ (dollar sign) should be protected.

Directory Pattern Matching

The & (ampersand) character is expanded to the value of the key field
for the entry in which it occurs.  In the following example, the &
expands to able.

able prime:/home/prime:&

The * (asterisk) character, when supplied as the key field, is
recognized as the catchall entry.  Such an entry will be used if any
previous entry has not successfully matched the key being searched
for.  For example, if the following entry appeared in the indirect map
for /home,

*   &:/home/&

it would allow automatic mounts in the /home directory of any remote
file system.  Their location could be specified as:

hostname:/home/hostname

Multiple Mounts

A multiple mount entry takes the form:

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

The initial / (forward slash) within /[mountpoint] is required.  The
optional mount point is taken as a path name relative to the
destination of the symbolic link for key.  If the mountpoint  option is
omitted in the first occurrence, a mount point of / (or the root
directory) is assumed.  An example of a direct map entry follows:

/arch/src  \   /                   -ro,intr
arch:/arch/src           alt:/ arch/src   \      /1.0
-ro,intr       alt:/arch/src/1.0        arch:  /arch/src/1.0   \
/1.0/man  -ro,intr       arch:/arch/src/1.0/man   alt:/arch/src/1
.0/man


The /arch/src, /arch/src/1.0 and /arch/src/1.0/man  are mounted as
needed, from either arch  or alt, whichever host responded first.  If
the mounts are hierarchically related, mounts closer to the root must
appear before submounts.  All the mounts in a multiple mount entry will
occur together and will be unmounted together.  This is important if
the file systems 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 another map by
entering:

+mapname

The mapname can be a file name or the name of an NIS map.  Or, the
mapname can be one of the special maps described in the following
section.  If the key being searched for is not located in an included
map, the search continues with the next entry.

Special automount command Maps

There are two special maps available: -hosts, and -null.  The -hosts
map uses the NIS  hosts.byname map to locate a remote host when the
host name is specified.  This map specifies mounts of all exported file
systems from any host.  For example, if the following automount command
is in effect:

automount /net -hosts

then a reference to /net/hermes/usr would initiate an automatic mount
of all file systems from hermes that automount  can mount; references
to a directory under /net/hermes will refer to the corresponding
directory relative to the hermes root directory.

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 the auto.master file or for a mount point specified as an
entry in a direct map.

Configuration and the auto.master Map File

The automount command normally consults the auto.master NIS
configuration map for a list of initial automount maps, and establishes
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 the -f flag override those in the NIS auto.master
map.  For example, given the command:

automount -f

/etc/auto.master /home -null   /-  /etc/auto.direct

and a /etc/auto.master  file containing:

/home auto.home

the automount command would ignore the /home entry in the
/etc/auto.master file.

Special automount daemon Maps

There are two special maps that the automount daemon can use.  They are
described in the command documentation for the automount daemon.  The
first is the -passwd map.  It is not recommended that this special map
be used.  It does not work very well with the login process.  The
alternative is to use something like the auto.home map as described
above.  This can be developed to provide similar functionality.  The
other map is the -hosts map.  This map works well and can be used to
offer a powerful mounting tool for users.  This map provides the means
to mount all available directories from a particular server.

Suggested Reading

Prerequisite Information

 Network  Information Service (NIS) Overview for System Management,
 Network File System (NFS) Overview for System  Management.

Related Information

 Understanding Secure NFS.

 How to  Export a Directory Using Secure NFS,  How to  Mount a File
 System Using Secure NFS,  How to  Mount a File System Using the
 automount Daemon,  How to Unmount a File System Using NFS.

The  make command,  mount command.

The  automount daemon.

The  /etc/filesystems file.



--
curt@aixwiz.austin.ibm.com (Curt L. Finch) | AIX NFS/NIS Field Quality 
My views are unrelated to those of IBM     |       Austin, TX
 -If you vote against Bush, be fair and throw out Congressional incumbents too-