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:
With -hosts you cannot choose individual mount points at which
to mount each filesystem;
all mounting is to a single mount point.
By convention, this mount point is /net.
(Note that other mount points can be used; in this document,
the convention /net is used.)
For example, the conventional use of -hosts in a master map would be:
/net -hosts mount_options
Further, with -hosts, automount mounts all filesystems
under the name of the server from which they are being mounted.
For example, all filesystems from the server london would
be mounted under /net/london.
With -hosts, automount mounts all
exported filesystems from a
server at the same time when any exported file or directory
structure on that server is accessed.
With -hosts, automount mounts all filesystems with
the same mount options, either the default options or those
listed with the -hosts map entry.
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:
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.