How Autofs Works

Autofs is a kernel file system that supports automatic mounting and unmounting. The components that work together to accomplish automatic mounting are:

  • automount command

  • autofs file system

  • automountd daemon

Autofs is a client-side service that automatically mounts the appropriate file system. The automount service, svc:/system/filesystem/autofs, which is called at system startup time, reads the master map file auto_master to create the initial set of autofs mounts. These autofs mounts are not automatically mounted at startup time but rather are points under which file systems are mounted in the future. These points are also known as trigger nodes. For more information about starting the navigation process, see How Autofs Starts the Navigation Process.

The following figure shows how the autofs service starts the automountd daemon.

svc:/system/filesystem/autofs Service Starts automount


Graphic illustrates how the autofs service starts the automountd daemon.

After the autofs mounts are set up, these mounts can trigger file systems to be mounted under them. For example, when autofs receives a request to access a file system that is not currently mounted, autofs calls automountd, which actually mounts the requested file system.

When a request is made to access a file system at an autofs mount point, the following occurs:

  1. Autofs intercepts the request.

  2. Autofs sends a message to the automountd daemon for the requested file system to be mounted.

  3. The automountd daemon locates the file system information in a map, creates the trigger nodes, and performs the mount.

  4. Autofs allows the intercepted request to proceed.

  5. Autofs unmounts the file system after a period of inactivity.

After initially mounting autofs mounts, use the automount command to update autofs mounts as necessary. The command compares the list of mounts in the auto_master map with the list of mounted file systems in the mount table file /etc/mnttab (formerly /etc/mtab). automount then makes the appropriate changes. This process enables system administrators to change mount information within auto_master and have those changes used by the autofs processes without stopping and restarting the autofs daemon. After the file system is mounted, further access does not require any action from automountd until the file system is automatically unmounted.

Unlike mount, automount does not read the /etc/vfstab file (which is specific to each computer) for a list of file systems to mount. The automount command is controlled within a domain and on computers through the name space or local files.

Note:

Mounts that are managed through the autofs service should not be manually mounted or unmounted. Even if the operation is successful, the autofs service does not check that the object has been unmounted, resulting in possible inconsistencies. A reboot clears all the autofs mount points.