Notes on
the -hosts Map |
 |
The -hosts map is a built-in AutoFS map; you need not create
it. The -hosts map causes AutoFS to mount exported directories
from any NFS server found in the hosts database, whenever a user
or a process requests access to one of the exported directories
from that server.
 |
 |  |
 |
 | CAUTION: A user may inadvertently cause an NFS mount over
X.25 or SLIP, which is unsupported, or through a slow router or
gateway, because the -hosts map allows NFS access to any reachable remote
system. Mounts over slow links can cause excessive retransmissions,
and degrade the performance for all users. |
 |
 |  |
 |
When a user or a process requests a directory from an NFS
server, AutoFS creates a subdirectory named after the NFS server,
under the local mount point you configured in the AutoFS master
map. (The conventional mount point for the -hosts map is /net). AutoFS then mounts the exported or shared directories
from that server. These exported or shared directories can now be
accessed. Directories stay mounted until they remain left idle for
10 minutes. You can change the default value by adding the -t duration option to the AUTOMOUNT_OPTIONS variable in the /etc/rc.config.d/nfsconf file, or by running the automount command
with the -t option from the command
line.
The -hosts map is an indirect map. It uses the hosts database
(the /etc/hosts file, the NIS hosts map, LDAP, or BIND [DNS]) to find a host on the
network. The Name Service Switch configuration determines which
name services to search for host information. For more information
on configuring the name service switch, see nsswitch.conf (4).
For example, if the server, sage exports /opt and /apps, and a user on your NFS client enters the following
command:
the subdirectory /sage is created under /net, and /opt is mounted under /sage.
Figure 3-6 “Automounted Directories from the -hosts Map—One Server” shows the automounted
file structure after the user runs the command.
In the following example, the server, thyme exports or shares the directory /exports/proj1, and a user enters the following command:
more /net/thyme/exports/proj1/readme |
For example, the following entry from a map mounts the source
code and the data files for a project whenever anyone requests access
to both of them. They are mounted for on-demand mounting. The subdirectory /thyme is created under /net, and /exports/proj1 is mounted under /thyme.
Figure 3-7 “Automounted Directories from the -hosts Map—Two Servers” shows the automounted
directory structure after the user enters the second command.