automount: Automatically Mounts Directory Hierarchies


automount: Automatically Mounts Directory Hierarchies

With distributed computing, when you log in on any system on the network, all of your files, including startup scripts, are available. In a distributed computing environment, all systems are commonly able to mount all directory hierarchies on all servers: Whichever system you log in on, your home directory is waiting for you.

As an example, assume that /home/alex is a remote directory hierarchy that is mounted on demand. When you issue the command ls /home/alex, autofs goes to work: It looks in the /etc/auto.home map, finds that alex is a key that says to mount bravo:/export/home/alex, and mounts the remote directory hierarchy. Once the directory hierarchy is mounted, ls displays the list of files you want to see. If you give the command ls /home after this mounting sequence, ls shows that alex is present within the /home directory. The df utility shows that alex is mounted from bravo.

Prerequisites

Install the following package:

  • autofs

Run chkconfig to cause autofs to start when the system enters multiuser mode:

# /sbin/chkconfig autofs on


Start autofs:

# /sbin/service nfs start


More Information

Local


man pages autofs, automount, auto.master

Web


tutorial www.linuxhq.com/lg/issue24/nielsen.html

HOWTO


Automount mini-HOWTO

autofs: Automatically Mounted Directory Hierarchies

An autofs directory hierarchy is like any other directory hierarchy, but remains unmounted until it is needed, at which time the system mounts it automatically (demand mounting). The system unmounts an autofs directory hierarchy when it is no longer neededby default after five minutes of inactivity. Automatically mounted directory hierarchies are an important part of administrating a large collection of systems in a consistent way. The automount daemon is particularly useful when an installation includes a large number of servers or a large number of directory hierarchies. It also helps to remove serverserver dependencies (discussed next).

When you boot a system that uses traditional fstab-based mounts and an NFS server is down, the system can take a long time to come up as it waits for the server to time out. Similarly, when you have two servers, each mounting directory hierarchies from the other, and both systems are down, both may hang as they are brought up and each tries to mount a directory hierarchy from the other. This situation is called a serverserver dependency. The automount facility gets around these issues by mounting a directory hierarchy from another system only when a process tries to access it.

When a process attempts to access one of the directories within an unmounted autofs directory hierarchy, the kernel notifies the automount daemon, which mounts the directory hierarchy. You have to give a command, such as cd /home/alex, that accesses the autofs mount point (in this case /home/alex) so as to create the demand that causes automount to mount the autofs directory hierarchy so you can see it. Before you issue the cd command, alex does not appear to be in /home.

The main file that controls the behavior of automount is /etc/auto.master. A simple example follows:

# cat /etc/auto.master /free1 /etc/auto.misc  --timeout 60 /free2 /etc/auto.misc2 --timeout 60


The auto.master file has three columns. The first column names the parent of the autofs mount pointthe location where the autofs directory hierarchy is to be mounted (/free1 and /free2 in the example are not mount points but will hold the mount points when the directory hierarchies are mounted). The second column names the files, called map files, that store supplemental configuration information. The optional third column holds mount options for map entries that do not specify an option.

Although the map files can have any names, one is traditionally named auto.misc. Following are the two map files specified in auto.master:

# cat /etc/auto.misc sam                 -fstype=ext3                     :/dev/hda8 # cat /etc/auto.misc2 helen               -fstype=ext3                     :/dev/hda9


The first column of a map file holds the relative autofs mount point (sam and helen). This mount point is appended to the corresponding autofs mount point from column 1 of the auto.master file to create the absolute autofs mount point. In this example, sam (from auto.misc) is appended to /free1 (from auto.master) to make /free1/sam. The second column holds the options, and the third column shows the server and directory hierarchy to be mounted. This example shows local drives; for an NFS-mounted device, the hostname of the remote system would appear before the colon (for example, grape:/home/sam).

Before the new setup can work, you must create directories for the parents of the mount points (/free1 and /free2 in the preceding example) and start (or restart) the automount daemon using the autofs init script. The following command displays information about configured and active autofs mount points:

# /sbin/service autofs status





A Practical Guide to Red Hat Linux
A Practical Guide to Red HatВ® LinuxВ®: Fedoraв„ў Core and Red Hat Enterprise Linux (3rd Edition)
ISBN: 0132280272
EAN: 2147483647
Year: 2006
Pages: 383

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