About automount maps
automount determines which mount points to monitor and
which filesystems to mount from a special set of configuration
files called maps.
Maps can reside on the local machine
or be managed via NIS.
By convention, all local automount maps are located in the
/etc directory and have filenames prefixed with
auto.
There are four types of automount map:
You should also understand
when map modifications take place.
Master automount maps
A master map provides:
-
a pointer to the direct, indirect, and built-in maps that
automount is to use.
-
the mount point for each indirect and built-in map listed in this master
map.
-
optionally, mount options that apply to all mounts in each map
listed in this master map.
By default, automount looks for an NIS master map
named auto.master when it starts up.
Options to the automount command can direct automount to
use a local master map (-f option) or
ignore the NIS master map (-m option).
If a local master map is specified with the -f option and the
-m option is not specified, automount reads
both master maps,
but entries in the local master map have priority if duplicates
between the two master maps occur.
The names of direct, indirect, and built-in maps can be
passed as arguments to the automount command in lieu of or
in addition to using a master map.
Each line in the master map (by convention called
/etc/auto.master) has the syntax:
mount_point map_name [ mount_options ]
mount_point-
May be either a full pathname or the string ``/-''.
A full pathname tells automount that the map-name field value
is the name of an indirect map or a built-in map.
Whether an indirect or built-in map is used,
automount uses the pathname to build
the mount point
on which automount is to mount the filesystems listed in the map.
If any of the directories in the pathname do not exist, automount
creates them, if possible. If the basename directory exists and is
not empty, mounting on it hides its contents.
automount issues a warning message in this case.
The string ``/-'' tells automount that the map-name
field value is the name of a direct map that automount is to read
for filesystems to mount.
map_name-
Is the name of a direct, indirect, or built-in map.
mount_options-
Is an optional list of options (separated by commas)
that regulate the mounting of the entries
mentioned in map_name, unless the entries in
map_name list other options. Mount options
listed in a direct or indirect map override options listed here.
You may specify options here that are defined for NFS-type
mounts in the
mount(ADM)
reference manual page, excluding bg (background) and
fg (foreground), which do not apply.
For a sample map, see
``Creating master automount maps''.
Direct automount maps
Direct maps are used to
specify direct mounts and contain a separate entry for
each direct mount point.
A direct map entry can also contain pointers to other maps that
automount should read (that is, nested maps).
There can be more than one direct map.
Map nesting is described in the section
``Mixing local and distributed automount maps''.
The syntax for a direct map is:
key [ mount_options ] location [ location ] . . .
Here:
key-
Is the full pathname of the mount point.
mount_options-
Are the options you want to
apply to this particular mount.
Options specified here override options that may be specified elsewhere
for this direct map (for example, in the master map or on the
automount command line).
You may specify options here that are defined for NFS-type
mounts in the
mount(ADM)
reference manual page,
excluding
bg
(background) and
fg
(foreground), which do not apply.
location-
Is the location of the resource, specified as
server:pathname[:subdirectory].
Use of the optional subdirectory field is explained in
``Optimizing subdirectory mounting''.
The use of multiple locations is explained in
``Specifying redundant servers''.
For an example direct map, see
``Creating indirect and direct automount maps''.
Indirect automount maps
Indirect maps are used to
specify indirect mounts and contain a separate entry for
each indirect mount point.
An indirect map does not contain the full pathname of the
indirect mount point.
In this way, an indirect map is dependent on the master map,
arguments to the automount command, or, through map nesting,
a direct or indirect map.
There can be more than one indirect map.
The syntax for an indirect map is:
key [ mount_options ] location [ location ] . . .
key-
Is the basename (not the full pathname) of
the directory that is used as the mount point.
Once the key is obtained by automount, it is
appended to the pathname associated with this map to define
the mount point.
The association is made either on the automount command
line or in another map. Typically, the other map is the master map.
The section
``Mixing local and distributed automount maps'',
however, describes how maps may be nested. Through nesting, the other
map may be a direct or indirect map.
mount_options-
Are the options you want to
apply to this particular mount.
Options specified here override options that may be specified elsewhere
for this mount point (for example, in the master map or on the
automount command line).
You may specify options here that are defined for NFS-type
mounts in the
mount(ADM)
reference manual page, excluding bg (background) and
fg (foreground), which do not apply.
location-
Is the location of the resource,
specified as server:pathname[:subdirectory].
Use of the optional subdirectory field is explained in
``Optimizing subdirectory mounting''.
The use of multiple locations is explained in
``Specifying redundant servers''.
For an indirect map example see
``Creating indirect and direct automount maps''.
Built-in automount maps
There are three strings that can appear in place of an
indirect or direct map_name. These strings are
referred to as ``built-in maps'', although they are not maps
in the way master, direct, and indirect maps are.
These three built-in maps are:
The ``-'' indicates to automount that this value
is a built-in map.
The -hosts built-in map
The -hosts map provides a simple way of configuring
automount to mount all exported
filesystems from all known hosts.
The use of the -hosts map may be considered batch automounting.
Known hosts are those that the local host can identify through
the use of the Domain Name Service (DNS) if running or by the
content of the local host's /etc/hosts file.
The major differences in using -hosts from listing separately
in automount maps
each exportable filesystem from each known host are:
The advantages of using the -hosts map are:
-
Multiple mounts are allowed without having to specify each filesystem
that is to be exported.
-
The clients' maps need not be updated each time there are changes made to
the list of filesystems a server exports.
-
The use of this map reduces entries in the /etc/default/filesys
file and in automount maps and, therefore, reduces administration
when a client needs to mount many directories from many
servers.
-
The use of -hosts provides a
very convenient way to provide users with access to many
different directories on many
different hosts without their having to use rlogin or
rcmd.
Here is an example of -hosts map usage:
-
On the NFS client paris running automount,
the administrator specifies the -hosts map in the automount
master map:
/net -hosts
-
When automount starts, it builds the mount point
named /net and listens for requests that cross this mount point.
-
A user executes:
cd /net/london
-
automount detects that the mount point /net has
been accessed.
It consults its maps and finds that the -hosts built-in map is
specified for the /net mount point.
automount executes the library routine
gethostbyname london
(See
gethostbyname(SLIB)
for information on this command.)
This command queries the name server, that is
named(ADMN),
if running or, if the name server is not running, looks for
an entry for london in
the /etc/hosts file on the local host.
gethostbyname returns information on how to reach
the server london.
(If gethostbyname cannot acquire this information,
the cd command fails.)
-
automount queries london's mount service using
the RPC null
procedure to check whether it is responding.
-
If london's mount service responds, automount requests of
london the list of all filesystems
that london is permitted to export to paris.
-
automount sorts the received list according to the length
of the pathname. For example:
/usr/src
/export/home
/usr/src/sccs
/export/root/blah
This sorting ensures that the mounting is done in the proper
order, that is, /usr/src is done before
/usr/src/sccs.
-
automount creates the mount points needed under /tmp_mnt
and creates the various directories needed under /net/london.
-
automount proceeds down the sorted list, mounting all the
filesystems at mount points in /tmp_mnt.
-
automount links all of the /tmp_mnt mounted
filesystems to their respective locations under /net/london.
-
The user who executed the command cd /net/london is placed in the
root filesystem of the machine london.
The user, however, may not
see all the files and directories under the root filesystem
of the server london.
This is because automount can mount only
the filesystems that london has permission to export
to paris.
This permission is configured
in the /etc/exports file on the server london.
-
automount unmounts all of the filesystems mounted
from london at one time when all activity in these
filesystems on the client paris ceases for the idle
duration specified on the automount daemon command line.
NOTE:
If the user had executed the command cd /net/london/usr
instead of cd /net/london, automount would
still mount all exportable filesystems from london and
not just /net/london/usr.
See
``Using built-in automount maps''
for examples of using the -hosts map.
The -passwd built-in map
The -passwd map provides a simple way
of configuring automount to distribute user home directories
from a single server to any client.
Here is an example of how it could be used:
-
Start automount as:
automount /home/servername -passwd
servername must be the name of the server on which all user home
directories physically reside.
-
On the server, ensure that the user home directories are in:
/home/servername/username
-
On each client intended to automount users' home directories,
ensure that the home directory of each user in the
/etc/passwd file is in the form:
/home/servername/username
-
Inform users to change directories to their home directories
on a client machine by entering:
cd /home/servername/username
To process this entry, automount:
-
detects that the /home/servername mount point has
been accessed and finds that the -passwd built-in
map applies to this mount point.
-
executes getpwnam, which searches
the /etc/passwd file on the
local host for an entry for user. If it finds an entry, it extracts the
``initial working directory'' field
value, /home/servername/username.
-
mounts /home/servername from servername
-
creates a symbolic link
from /tmp_mnt/home/servername/username
to /home/servername/username
For this map, the tilde character (~) is recognized as a
synonym for the username.
If you wish to distribute user home directories
from multiple servers, here is one method:
-
Create an indirect map, including entries such as:
john moscow:/u3/&
bob moscow:/u3/&
jim moscow:/u3/&
pat moscow:/u3/&
beth moscow:/u3/&
louise moscow:/u3/&
brad moscow:/u3/&
pam prague:/u3/&
betty prague:/u3/&
mike prague:/u3/&
tom prague:/u3/&
joanne prague:/u3/&
doug prague:/u3/&
milan:/u3/&
When reading this indirect map, automount queries
milan for any username it does not find in the indirect map.
For an explanation of the use of the ``&'' and ``''
characters, see
``Simplifying map syntax''.
-
Create a master map with the entry:
/home indirect_mapname
-
To have home directories mounted from the server on which they
reside without needing to know the source location, inform users
to enter:
cd /home/username
The -null built-in map
The -null built-in map is always used in association with a
mount point and tells automount not to mount any
remote filesystems to this mount point on the local host.
This excludes any mounts to the associated mount point that may
be specified:
-
on the automount command line.
-
in any master or direct maps read by automount.
(Indirect maps do not include a mount point and so are not
relevant to this discussion.)
This map is typically used to prevent an NIS map from
specifying a mount to a mount point that the local system
does not want covered. Remember that a remote filesystem,
when automounted, hides any existing files or
directories under that mount point.
Here is an example of -null map usage on the automount
command line:
automount /usr/bin -null
In this example, automount will ignore all instructions to
mount remote filesystems to /usr/bin.
See
``Using built-in automount maps''
for further examples of using the -null map.
See also:
Understanding map modifications
You can modify automount maps at any time.
However, this does not guarantee that all your modifications
will take effect the next time automount mounts
a filesystem.
That depends on what map you modify and what kind of
modification you introduce.
master map-
automount consults the master map only at startup
time.
A modification to the master map will take effect only the
next time you restart automount.
NOTE:
Rebooting your machine is
the safest way of restarting automount.
indirect maps-
Entries can be modified, deleted, or added to indirect maps
and the change will take effect next time the map is used,
which is the next time a mount occurs.
direct maps-
Each entry in a direct map is an automount mount point and
automount only mounts its daemon at these mount points at startup.
Therefore, adding or deleting an entry in a direct map will
take effect only the next time you restart automount.
Existing entries, however, can be modified (for example, changing
mount options or server names, but not names of mount points)
while automount is running, and these will take effect when the
changed entry
is next mounted, because automount consults the direct maps
whenever a mount has to be done.
For instance, suppose you modify the file
/etc/auto.direct
so that the directory
/usr/src
is now mounted from a different server.
The new entry takes effect
immediately (if
/usr/src
is not mounted at this time) when you try to access it.
If it is mounted now,
you can wait until the default unmounting
takes place before you access it.
If this is not satisfactory,
you can unmount with the
umount
command; if you do, you must notify automount
that the mount table has changed (see
``Stopping and restarting automount'')
before accessing the directory.
You can now mount the directory from the new server.
However, if you wanted to delete the direct map entry containing
/usr/src, you would have
to restart automount for the deletion to take effect.
NOTE:
Because entries can be added to and deleted from indirect maps without
restarting automount and because they do not clutter the mount
table like direct maps do, indirect maps are preferable and
should be used whenever possible.
See also:
Next topic:
About mount point conflicts
Previous topic:
An example of indirect mounting using automount
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003