Managing NFS and NIS, 2nd Edition - Mike Eisler [115]
drwxrwxr-x 5 root other 512 Jun 10 17:03 news
dr-xr-xr-x 1 root root 19 Aug 31 12:59 sting
Invoking the ls command on /tools/news causes /tools/news to be NFS-mounted from thud:/tools3/news. When the readdir entry point in the autofs filesystem is called on /tools for the second time, there is now an NFS directory, news, underneath it. Thus, autofs combines the list of map entries with the list of NFS-mounted directories.
By default, indirect maps can be browsed, but browsing can be turned off with the -nobrowse option to an indirect map.
Direct maps
Direct maps define point-specific, nonuniform mount points. The best example of the need for a direct map entry is /usr/man. The /usr directory contains numerous other entries, so it cannot be an indirect mount point. Building an indirect map for /usr/man that uses /usr as a mount point will "cover up" /usr/bin and /usr/etc. A direct map allows the automounter to complete mounts on a single directory entry.
The key in a direct map is a full pathname, instead of the last component found in the indirect map. Direct maps also follow the /etc/auto_contents naming scheme. Here is a sample /etc/auto_direct:
/usr/man wahoo:/usr/share/man
/usr/local/bin mahimahi:/usr/local/bin.sun4
The automounter registers the entire direct mount point pathname in the mnttab file, instead of the parent directory of all of the mount points:
auto_direct /usr/local/bin autofs ignore,direct,intr,ro,dev=2cc000a 933723158
The mnttab entry's map type is listed as direct. Operation of the automounter on a direct mount point is similar to the handling of an indirect mount. The autofs automounter is passed the entire direct mount point pathname in the RPC from autofs, since the mount point is the key in the map. See Table 9-1 for automounter map entry formats.
A major difference in behavior is that the real direct mount points are always visible to ls and other tools that read directory structures. The automounter treats direct mounts as individual directory entries, not as a complete directory, so the automounter gets queried whenever the directory containing the mount point is read. Client performance is affected in a marked fashion if direct mount points are used in several well-traveled directories. When a user reads a directory containing a number of direct mounts, the automounter initiates a flurry of mounting activity in response to the directory read requests. Section 9.5.3 describes a trick that lets you use indirect maps instead of direct maps. By using this trick, you can avoid mount storms caused by multiple direct mount points.
Table 9-1. Automounter map entry formats
Key
Mount options
Server:directory pair
indirect map: deskset
mahimahi:/tools2/deskset
direct map: /usr/man
-ro
thud:/usr/man
* * *
[1] The automounter is included in Solaris, Compaq's Tru64 Unix, SGI's IRIX, IBM's AIX, and other commercial Unix operating systems. A public domain version called amd is available on http://www.cs.columbia.edu/~ezk/am-utils/ and amd runs on almost any Unix system. Because it is kernel- and server-independent, the amd automounter is easily migrated to other NFS client platforms.
Invocation and the master map
Now that we've seen how the automounter manages NFS mount information in various maps, we'll look at how it chooses which maps to use and how it gets started. The key file that tells the automounter about map files and mount points is the master map, which is the default map read by the automounter if no other command-line options are specified. This covers the format and use of the master map, some command-line options, and some timeout tuning techniques.
The master map
The master map is the map of maps. When the automounter is started, it reads the master map from where the /etc/nsswitch.conf configuration file says to read it, as determined by the nsswitch.conf entry named automount:. Thedefault nsswitch.conf — whether files, or NIS is used — has files listed first. The master map file, /etc/auto_master, lists all direct and indirect maps and their