Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
NFS Services Administrator’s Guide: HP-UX 11i version 3 > Chapter 3 Configuring and Administering AutoFS

Special Maps

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

There are two types of special maps: -hosts and -null.

By default, the -hosts map is used with the /net directory and assumes that the map entry is the hostname of the NFS server. The automountd daemon dynamically creates a map entry from the server's list of exported filesystems. For example, a reference to /net/Casey/usr initiates an automatic mount of all the exported filesystems from Casey which can be mounted by the client. References to the directory under /net/Casey refers to the corresponding directory relative to the root directory of Casey.

The -null map, when included in a map entry, cancels a map for the directory indicated. This is especially useful in the AutoFS master map, /etc/auto_master, for cancelling entries that would otherwise be inherited from the +auto_master include entry. To be effective, the -null entry must be inserted before the included map entry. For information on how to include a map in another map, see “Including a Map in Another Map”.

Automounting All Exported Directories from Any Host Using the -hosts Map

To automount all exported directories using the -hosts map, follow these steps:

  1. If you are using local files for AutoFS maps, use an editor to add the following entry to the /etc/auto_master master map file:

    /net -hosts -nosuid,soft,nobrowse 
    NOTE: The nobrowse option in the local default master map file for a newly installed system is specified for the /net map.

    If you are using NIS to manage AutoFS maps, add the previous entry to the master map file on the NIS master server. Rebuild the map and push it out to the slave servers. For more information on NIS and NIS maps, see the NIS Administrator’s Guide (5991-7656). If you are using LDAP, add the entry to the LDAP directory.

  2. On each host that uses the map you modified, enter the following command to force AutoFS to read the modified map:

    /usr/sbin/automount

Notes on the -hosts Map

The -hosts map is a built-in AutoFS map. It enables 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: You 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 directories from that server. These exported directories are now accessible.

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 discover the host on the network. The NSS configuration determines which name services to search for host information. For more information on configuring the NSS, see nsswitch.conf(4).

For example, if the server, Basil exports /opt and /apps, and a user on your NFS client enters the following command:

cd /net/basil/opt/frame

the subdirectory, /basil is created under /net, and /opt is mounted under /basil.

Figure 3-8 shows the automounted file structure after the user enters the command.

Figure 3-8 Automounted Directories from the -hosts Map—One Server

Automounted Directories from the -hosts Map—One Server

In the following example, the server thyme exports the directory /exports/proj1, and a user enters the following command:

more /net/thyme/exports/proj1/readme

The subdirectory /thyme is created under /net, and /exports/proj1 is mounted under /thyme.

Figure 3-9 shows the automounted directory structure after the user enters the second command.

Figure 3-9 Automounted Directories from the -hosts Map—Two Servers

Automounted Directories from the -hosts Map—Two Servers

Turning Off an AutoFS Map Using the -null Map

To turn off a map using the -null map, follow these steps:

  1. Add a line with the following syntax in the AutoFS master map:

    local_directory -null
  2. If AutoFS is running, enter the following command on each client that uses the map, to force AutoFS to reread its maps:

    /usr/sbin/automount

    This enables AutoFS to ignore the map entry that does not apply to your host.

Notes on the -null Map

The -null map is used to ignore mapping entries that do not apply to your host, but which would otherwise be inherited from the NIS or LDAP maps.

The -null option causes AutoFS to ignore AutoFS map entries that affect the specified directory. For example, an NIS (or LDAP) auto_master map is configured such that AutoFS mounts the auto_home map on /home, as follows:

/home auto_home

You can include the following line in the /etc/auto_master file, before the +auto_master entry, so that the NIS auto_home map is not used for the system:

/home -null

+auto_master

NOTE: The -null entry must precede the included map entry to be effective.

Using Executable Maps

An executable map is a map whose entries are generated dynamically by a program or a script. AutoFS determines whether a map is executable, by checking whether the execute bit is set in its permissions string. If a map is not executable, ensure that its execute bit is not set. An executable map is an indirect map.

When the AutoFS daemon locates a map whose execute bit is set, then instead of opening the file and searching for an entry, the daemon executes the file as a program and passes the key to be located within the map as an argument. Executable AutoFS maps return a map entry on the standard output. If they cannot supply a map entry for the key, they do not return anything. You can list executable AutoFS maps in the master map or include them in the local AutoFS map files. However, executable maps cannot be used with NIS and LDAP.

For example, an executable map implemented as a shell script, emulates the AutoFS built-in -hosts map for /net. It obtains a list of exported file systems from an NFS server (its name is the key argument). It then formats the path names into a multiple-mount map entry and sorts the list to order the mounts correctly into a top-down hierarchy, as follows:

!/bin/sh 
Server=$1
showmount -e $1 | awk ‘NR > 1 {print $1 “\t'$Server’:” $1 ” \\ “}’ | sort
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2008 Hewlett-Packard Development Company, L.P.