Networking Guide
Chapter 13, Configuring the NFS automounter

Using multiple direct mounts

Using multiple direct mounts

You can mount multiple remote filesystems to a single local directory with a direct mount configuration. This section compares the two ways in which you can configure direct multiple mounts with an analogous indirect mount.

Figure 13-2, ``An example of indirect mounting using automount'', illustrates an indirect mount where two filesystems, each from a different server, are mounted under a single parent directory. In this indirect mount, each of the remote filesystems is mounted only when that remote filesystem is accessed. Further, if you access one directory, causing it to be mounted, and then try to cd to the other using a relative path, the system will not find or mount the other directory. For example:

cd /doc_tools/spellers
cd ../roff
../roff: No such file or directory

To reach /doc_tools/roff would require:

cd /doc_tools/roff

If you access /doc_tools/roff before executing cd ../roff, with the ls command for example, then /doc_tools/roff gets mounted and you can reach it using a relative path.

Here is an example showing one way in which you could mount the same two remote filesystems under a single parent, but using a direct mount configuration:

   /doc_tools/spellers     -r,soft   madrid:/doc.stuff/spellers
   /doc_tools/roff         -r,soft   oslo:/doc/bin/roff
Like the indirect mount configuration, each of the remote filesystems here is mounted separately and only when that remote filesystem is accessed. With this configuration, if you access one directory, causing it to be mounted, and then try to cd to the other using a relative path, automount will mount the other filesystem and place the user in the desired directory if the user is running ksh. If the user is not running ksh, the system will not find or mount the other directory, as in the indirect map configuration.

Here is an example showing a second way in which you can mount the same two remote filesystems under a single parent, but using a single direct configuration.

   /doc_tools \
                  /spellers    -r,soft   madrid:/doc.stuff/spellers \
                  /roff        -r,soft   oslo:/doc/bin/roff
With this configuration, both filesystems are mounted if either one is accessed. Because both filesystems are always mounted at the same time, a cd using a relative path between the two filesystems will work regardless of the shell being used. Note that the syntax of this configuration differs from the direct map syntax shown in ``About automount maps''. The parent directory appears on the first line with a ``\'' indicating a continued entry. Each subsequent line contains a mount point (that begins with a slash), options, and a location. Redundant locations can be specified as described in ``Specifying redundant servers''.

This ``unified mount'' has these advantages over the previous direct mount example:


The ``unified mount'' has these advantages over the indirect mount configuration: Remember, however, that an indirect mount configuration always has one advantage over direct mount configurations: indirect mount points under the virtual parent can be reconfigured without restarting automount. Changing direct mount configurations requires restarting automount. See ``Understanding map modifications''.

The above examples show remote filesystems residing on different servers. The above examples would still be valid if all remote filesystems were from the same server or there were more than two remote filesystems being mounted and all were from different servers.

If unified direct mounts share the same options, it is not necessary to duplicate these options for each server. Rather, the options can precede the different mounts:

   /doc_tools             -r,soft   \
               /spellers            madrid:/doc.stuff/spellers \
               /roff                oslo:/doc/bin/roff
If one of the mount points needs a different specification, modify only its options:
   /doc_tools             -r,soft   \
               /spellers  -rw       madrid:/doc.stuff/spellers \
               /roff                oslo:/doc/bin/roff

A special case of multiple direct mounts occurs when the root of a filesystem has to be mounted as well. This is called a ``hierarchical'' mount. A true hierarchical mount might be:

   /usr/local \
           /                   prague:/usr/local \
           /bin    -r,soft     tokyo:/usr/local/bin \
           /src    -r          milan:/usr/local/src


NOTE: A true hierarchical mount can be problematic if the server for the root of the filesystem goes down. Any attempt to unmount the lower branches fails, because the unmounting has to proceed through the mount root, which also cannot be unmounted while its server is down.