Networking Guide
Chapter 13, Configuring the NFS automounter

The -hosts 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:

Here is an example of -hosts map usage:

  1. On the NFS client paris running automount, the administrator specifies the -hosts map in the automount master map:
       /net -hosts
    

  2. When automount starts, it builds the mount point named /net and listens for requests that cross this mount point.

  3. A user executes:

    cd /net/london

  4. 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.) 

  5. automount queries london's mount service using the RPC null procedure to check whether it is responding.

  6. If london's mount service responds, automount requests of london the list of all filesystems that london is permitted to export to paris.

  7. 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.

  8. automount creates the mount points needed under /tmp_mnt and creates the various directories needed under /net/london.

  9. automount proceeds down the sorted list, mounting all the filesystems at mount points in /tmp_mnt.

  10. automount links all of the /tmp_mnt mounted filesystems to their respective locations under /net/london.

  11. 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.

  12. 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.