Lesson 5 Part II
Automounting NFS File Systems


With Redhat 9.0 an additional option for mounting an NFS share has come available.  This is the autofs script which uses the automount daemon to manage your mount points by only mounting them dynamically when they are accessed.

Autofs refers to a master map configuration file called /etc/auto.master to determine which mount points are defined. It then starts an automount process with the appropriate parameters for each mount point. Each line in the master map defines a mount point and a separate map file that defines the file systems to be mounted under this mount point. For example, the /etc/auto.misc file might define mount points in the /misc directory; this relationship would be defined in the /etc/auto.master file.

Each entry in auto.master has three fields. The first field is the mount point. The second field is the location of the map file, and the third field is optional. The third field can contain information such as a timeout value.

For example, to mount the directory /My_Documents on the remote machine called Hugyen at the mount point /mymounts/Hugyen on your machine, add the following line to auto.master:

/mymounts     /etc/auto.misc

Add the following line to /etc/auto.misc:

Hugyen    -rw,soft,intr  Hugyen:/My_Documents


The first field in /etc/auto.misc is the name of the /mymounts subdirectory. This directory is created dynamically by automount. It should not actually exist on the client machine. The second field contains mount options such as rw for read and write access. The third field is the location of the NFS export including the hostname and directory.


Note:   The directory /mymounts must exist on the local file system. There should be no subdirectories in /mymounts on the local file system.

Autofs is a service which can be started, restarted, status checked and stopped in two ways. To start the service, at a shell prompt, type the following command:

/etc/rc.d/init.d/autofs  start

To restart the autofs service, at a shell prompt, type the following command:

/etc/rc.d/init.d/autofs  restart

To view the active mount points, type the following command at the shell prompt;

/etc/rc.d/init.d/autofs  status

If you modify the /etc/auto.master configuration file while autofs is running, you must tell the automount daemon(s) to reload by typing the following command at a shell prompt:

/etc/rc.d/init.d/autofs  reload

If you don't happen to be a shell prompt type of person, a GUI based utility can be accessed by the path, Main Menu (Red Hat) --> System Settings --> Server Settings --> Services

Additional Resources

For additional resources concerning this topic refer to section 16.2.2 in the Customization Guide for RedHat 9.0 or Chapter 18: Setting Up a File Server pages 676 - 679.