34.1 Automounter Maps

   

Automounter uses map files to mount a remote file system or directory using NFS. Four types of maps are used with Automounter as listed next .

  1. the Master Automounter map

  2. the Direct Automounter map

  3. the Indirect Automounter map

  4. the Special Automounter map

These maps contain lists of files and directories that are to be mounted when needed. When a user tries to access a directory listed in these maps, Automounter tries to mount that directory from the NFS server. When a server is found, the Automounter creates a temporary mount point inside /tmp_mnt and mounts the remote file system on this mount point. It then creates a symbolic link to this directory for the actual mount point directory. When the mounted directory is not used for a certain period of time, Automounter unmounts the remote file system, removes the temporary mount point, and removes the symbolic link.

Master Map

The master map file is /etc/auto_master , and it is read by Automounter at startup time. Each line in this file shows one Automounter map. A line starts with a mount point followed by the map file name that corresponds to that mount point. In the last part of the line, any mount options can be used. However, these mount options can be overridden by mount options in other map files. The general syntax of an entry in this file is shown here.

 <mount point>   <map file name>   <mount options> 

A sample master map file is shown below.

 /-               /etc/auto_direct /home            /etc/auto_home /usr/share/man   /etc/auto_man /net             -hosts 

Each line starting with /- shows a direct map file. A line starting with an absolute directory name shows an indirect map. The last line in the file shows a special map. This is used to mount all file systems exported by a particular NFS server to a directory with the same name as the NFS server under the /net directory.

Direct Map

A direct map contains local mount points and corresponding file systems exported by an NFS server. The general syntax of entries in the direct map file is:

 <local mount point>   <mount options>   <server:/directory> 

Entries in the direct map are not related to each other. Each file system can be mounted and unmounted quite independently. When a user accesses a directory listed in the direct map, the automount daemon mounts the remote file system using a temporary mount point in /tmp_mnt and creates a symbolic link of this temporary mount point to the actual directory. A sample direct map file is shown next.

 /apps          hp0:/apps /opt/project   hp0:/project   myhp:/project 

The first line mounts a directory /apps from an NFS server hp0 to a local mount point /apps . The second line mounts the /projects directory from one of the two NFS servers, whichever is nearest . These two server names are hp0 and myhp .

Indirect Map

The indirect map provides a reference directory for local mount points. The path to this directory is present in the master map file. All local mount points reside inside this directory. The following line in the indirect map /etc/auto_home mounts a directory /home/boota from an NFS server hp0 to /home/boota on the local system.

 boota   hp0:/home/boota 

Mount options can be used in an indirect map after the local mount point directory.

Special Map

Automounter supports three types of special maps. These special maps are indicated in the /etc/auto_master file as -hosts , -passwd , and -null . The special map -hosts mounts all exported file systems from an NFS server under a directory in /net . This directory has the same name as the NFS server. Consider the following entry in the /etc/auto_master file.

 /net             -hosts 

When you try to access directory /net/hp0 , your system will contact NFS server hp0 and will try to mount all exported file systems by hp0 under this directory. If the server has no exported file system, you will get an error message.

The -passwd special map uses the /etc/passwd file to mount user home directories. The following line can be used in the /etc/auto_master file.

 /home             -passwd 

The -null special map is used with the automount command to cancel a previously used map.

Including Maps Within Other Maps

A map file can be included in another map using a + sign followed by the map file name. The following line includes the /etc/auto_abc map in another map file.

 +/etc/auto_abc 

Modifying Automounter Maps

When you make a change to any map file, the following rules show whether the automount daemon should be started.

  1. If you make a change to a master map, you must either reboot the system or kill the automount daemon and restart it. This is necessary because the automount daemon reads the master map only at startup time. However, when killing the automount daemon, don't use the kill -9 command. Instead, use the kill -TERM command that causes automount to shut down gracefully.

  2. If you modify options or the server part in a direct map, you don't need to restart the automount daemon. If you modify a mount point, you have to restart the automount daemon.

  3. There is no need to restart the automount daemon if you make a change to an indirect map.


   
Top


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net