?autofs | Red Hat Product Documentation (2024)

download

PDF

One drawback of using /etc/fstab is that, regardless of how infrequently a user accesses the NFS mounted file system, the system must dedicate resources to keep the mounted file system in place. This is not a problem with one or two mounts, but when the system is maintaining mounts to many systems at one time, overall system performance can be affected. An alternative to /etc/fstab is to use the kernel-based automount utility. An automounter consists of two components:

  • a kernel module that implements a file system, and

  • a user-space daemon that performs all of the other functions.

The automount utility can mount and unmount NFS file systems automatically (on-demand mounting), therefore saving system resources. It can be used to mount other file systems including AFS, SMBFS, CIFS, and local file systems.

Important

The nfs-utils package is now a part of both the 'NFS file server' and the 'Network File System Client' groups. As such, it is no longer installed by default with the Base group. Ensure that nfs-utils is installed on the system first before attempting to automount an NFS share.

autofs is also part of the 'Network File System Client' group.

autofs uses /etc/auto.master (master map) as its default primary configuration file. This can be changed to use another supported network source and name using the autofs configuration (in /etc/sysconfig/autofs) in conjunction with the Name Service Switch (NSS) mechanism. An instance of the autofs version 4 daemon was run for each mount point configured in the master map and so it could be run manually from the command line for any given mount point. This is not possible with autofs version 5, because it uses a single daemon to manage all configured mount points; as such, all automounts must be configured in the master map. This is in line with the usual requirements of other industry standard automounters. Mount point, hostname, exported directory, and options can all be specified in a set of files (or other supported network sources) rather than configuring them manually for each host.

8.3.1.Improvements in autofs Version 5 over Version 4

autofs version 5 features the following enhancements over version 4:

Direct map support

Direct maps in autofs provide a mechanism to automatically mount file systems at arbitrary points in the file system hierarchy. A direct map is denoted by a mount point of /- in the master map. Entries in a direct map contain an absolute path name as a key (instead of the relative path names used in indirect maps).

Lazy mount and unmount support

Multi-mount map entries describe a hierarchy of mount points under a single key. A good example of this is the -hosts map, commonly used for automounting all exports from a host under /net/host as a multi-mount map entry. When using the -hosts map, an ls of /net/host will mount autofs trigger mounts for each export from host. These will then mount and expire them as they are accessed. This can greatly reduce the number of active mounts needed when accessing a server with a large number of exports.

Enhanced LDAP support

The autofs configuration file (/etc/sysconfig/autofs) provides a mechanism to specify the autofs schema that a site implements, thus precluding the need to determine this via trial and error in the application itself. In addition, authenticated binds to the LDAP server are now supported, using most mechanisms supported by the common LDAP server implementations. A new configuration file has been added for this support: /etc/autofs_ldap_auth.conf. The default configuration file is self-documenting, and uses an XML format.

Proper use of the Name Service Switch (nsswitch) configuration.

The Name Service Switch configuration file exists to provide a means of determining from where specific configuration data comes. The reason for this configuration is to allow administrators the flexibility of using the back-end database of choice, while maintaining a uniform software interface to access the data. While the version 4 automounter is becoming increasingly better at handling the NSS configuration, it is still not complete. Autofs version 5, on the other hand, is a complete implementation.

For more information on the supported syntax of this file, see man nsswitch.conf. Not all NSS databases are valid map sources and the parser will reject ones that are invalid. Valid sources are files, yp, nis, nisplus, ldap, and hesiod.

Multiple master map entries per autofs mount point

One thing that is frequently used but not yet mentioned is the handling of multiple master map entries for the direct mount point /-. The map keys for each entry are merged and behave as one map.

Example8.2.Multiple Master Map Entries per autofs Mount Point

Following is an example in the connectathon test maps for the direct mounts:

/- /tmp/auto_dcthon/- /tmp/auto_test3_direct/- /tmp/auto_test4_direct

8.3.2.Configuring autofs

The primary configuration file for the automounter is /etc/auto.master, also referred to as the master map which may be changed as described in the Section8.3.1, “Improvements in autofs Version 5 over Version 4”. The master map lists autofs-controlled mount points on the system, and their corresponding configuration files or network sources known as automount maps. The format of the master map is as follows:

mount-point map-name options

The variables used in this format are:

mount-point

The autofs mount point, /home, for example.

map-name

The name of a map source which contains a list of mount points, and the file system location from which those mount points should be mounted.

options

If supplied, these applies to all entries in the given map provided they do not themselves have options specified. This behavior is different from autofs version 4 where options were cumulative. This has been changed to implement mixed environment compatibility.

Example8.3./etc/auto.master File

The following is a sample line from /etc/auto.master file (displayed with cat /etc/auto.master):

/home /etc/auto.misc

The general format of maps is similar to the master map, however the "options" appear between the mount point and the location instead of at the end of the entry as in the master map:

mount-point [options] location

The variables used in this format are:

mount-point

This refers to the autofs mount point. This can be a single directory name for an indirect mount or the full path of the mount point for direct mounts. Each direct and indirect map entry key (mount-point) may be followed by a space separated list of offset directories (subdirectory names each beginning with a /) making them what is known as a multi-mount entry.

options

Whenever supplied, these are the mount options for the map entries that do not specify their own options.

location

This refers to the file system location such as a local file system path (preceded with the Sun map format escape character ":" for map names beginning with /), an NFS file system or other valid file system location.

The following is a sample of contents from a map file (for example, /etc/auto.misc):

payroll -fstype=nfs personnel:/dev/hda3sales -fstype=ext3 :/dev/hda4

The first column in a map file indicates the autofs mount point (sales and payroll from the server called personnel). The second column indicates the options for the autofs mount while the third column indicates the source of the mount. Following the given configuration, the autofs mount points will be /home/payroll and /home/sales. The -fstype= option is often omitted and is generally not needed for correct operation.

The automounter create the directories if they do not exist. If the directories exist before the automounter was started, the automounter will not remove them when it exits.

To start the automount daemon, use the following command:

# systemctl start autofs

To restart the automount daemon, use the following command:

# systemctl restart autofs

Using the given configuration, if a process requires access to an autofs unmounted directory such as /home/payroll/2006/July.sxc, the automount daemon automatically mounts the directory. If a timeout is specified, the directory is automatically unmounted if the directory is not accessed for the timeout period.

To view the status of the automount daemon, use the following command:

# systemctl status autofs

8.3.3.Overriding or Augmenting Site Configuration Files

It can be useful to override site defaults for a specific mount point on a client system. For example, consider the following conditions:

  • Automounter maps are stored in NIS and the /etc/nsswitch.conf file has the following directive:

    automount: files nis
  • The auto.master file contains:

    +auto.master
  • The NIS auto.master map file contains:

    /home auto.home
  • The NIS auto.home map contains:

    beth fileserver.example.com:/export/home/bethjoe fileserver.example.com:/export/home/joe* fileserver.example.com:/export/home/&
  • The file map /etc/auto.home does not exist.

Given these conditions, let's assume that the client system needs to override the NIS map auto.home and mount home directories from a different server. In this case, the client needs to use the following /etc/auto.master map:

/home ­/etc/auto.home+auto.master

The /etc/auto.home map contains the entry:

* labserver.example.com:/export/home/&

Because the automounter only processes the first occurrence of a mount point, /home contain the contents of /etc/auto.home instead of the NIS auto.home map.

Alternatively, to augment the site-wide auto.home map with just a few entries, create an /etc/auto.home file map, and in it put the new entries. At the end, include the NIS auto.home map. Then the /etc/auto.home file map looks similar to:

mydir someserver:/export/mydir+auto.home

With these NIS auto.home map conditions, the ls /home command outputs:

beth joe mydir

This last example works as expected because autofs does not include the contents of a file map of the same name as the one it is reading. As such, autofs moves on to the next map source in the nsswitch configuration.

8.3.4.Using LDAP to Store Automounter Maps

LDAP client libraries must be installed on all systems configured to retrieve automounter maps from LDAP. On RedHat EnterpriseLinux, the openldap package should be installed automatically as a dependency of the automounter. To configure LDAP access, modify /etc/openldap/ldap.conf. Ensure that BASE, URI, and schema are set appropriately for your site.

The most recently established schema for storing automount maps in LDAP is described by rfc2307bis. To use this schema it is necessary to set it in the autofs configuration (/etc/sysconfig/autofs) by removing the comment characters from the schema definition. For example:

Example8.4.Setting autofs Configuration

DEFAULT_MAP_OBJECT_CLASS="automountMap"DEFAULT_ENTRY_OBJECT_CLASS="automount"DEFAULT_MAP_ATTRIBUTE="automountMapName"DEFAULT_ENTRY_ATTRIBUTE="automountKey"DEFAULT_VALUE_ATTRIBUTE="automountInformation"

Ensure that these are the only schema entries not commented in the configuration. The automountKey replaces the cn attribute in the rfc2307bis schema. Following is an example of an LDAP Data Interchange Format (LDIF) configuration:

Example8.5.LDF Configuration

# extended LDIF## LDAPv3# base <> with scope subtree# filter: (&(objectclass=automountMap)(automountMapName=auto.master))# requesting: ALL## auto.master, example.comdn: automountMapName=auto.master,dc=example,dc=comobjectClass: topobjectClass: automountMapautomountMapName: auto.master# extended LDIF## LDAPv3# base <automountMapName=auto.master,dc=example,dc=com> with scope subtree# filter: (objectclass=automount)# requesting: ALL## /home, auto.master, example.comdn: automountMapName=auto.master,dc=example,dc=comobjectClass: automountcn: /homeautomountKey: /homeautomountInformation: auto.home# extended LDIF## LDAPv3# base <> with scope subtree# filter: (&(objectclass=automountMap)(automountMapName=auto.home))# requesting: ALL## auto.home, example.comdn: automountMapName=auto.home,dc=example,dc=comobjectClass: automountMapautomountMapName: auto.home# extended LDIF## LDAPv3# base <automountMapName=auto.home,dc=example,dc=com> with scope subtree# filter: (objectclass=automount)# requesting: ALL## foo, auto.home, example.comdn: automountKey=foo,automountMapName=auto.home,dc=example,dc=comobjectClass: automountautomountKey: fooautomountInformation: filer.example.com:/export/foo# /, auto.home, example.comdn: automountKey=/,automountMapName=auto.home,dc=example,dc=comobjectClass: automountautomountKey: /automountInformation: filer.example.com:/export/&

?autofs | Red Hat Product Documentation (2024)

FAQs

What are the disadvantages of Autofs? ›

Executable Autofs Maps

The disadvantage to using an executable map is that the map needs to be installed on each host. An executable map cannot be included in either the NIS or the NIS+ name service. The executable map must have an entry in the auto_master file.

How to check autofs service in Linux? ›

The mount point for the NFS share is /nfs-mount/mynfs .
  1. Change to the mount point and get a directory listing. cd /nfs-mount/mynfs; ls -l.
  2. Get a file system disk usage report. df -Th. The output shows the NFS share and the autofs mount point details.

What is the difference between NFS and AutoFS? ›

Autofs , is auto mounting filesystem on demand like when ever you need it. NFS is like mounting a complete partition remotely and you will have availability of whole content of the partition.

Where is the autofs config file? ›

DESCRIPTION. Configuration settings used by automount(8) may be changed in the configuration file /etc/autofs. conf. This file contains two primary sections, autofs and amd.

What is the difference between Autofs and fstab? ›

This how-to describes how to mount your network shares via autofs. Autofs should be as performant as fstab based mounting but has the advantage that your shares are mounted on demand which also should give you more reliability in case of network interuptions.

What are the benefits of Autofs? ›

The goal of autofs is to provide on-demand mounting and race free automatic unmounting of various other filesystems. This provides two key advantages: There is no need to delay boot until all filesystems that might be needed are mounted.

When to use autofs? ›

AutoFS allows file systems to be mounted as needed. With this method of mounting directories, all file systems do not need to be mounted all of the time; only those being used are mounted.

What are the different types of Autofs? ›

Autofs uses three types of maps:
  • Master map.
  • Direct maps.
  • Indirect maps.

Does restarting autofs unmount? ›

The automounter can complete the unmounting either by waiting for the file systems to be automatically unmounted or by rebooting the system.

How does autofs work in Linux? ›

Autofs is an automount daemon that manages mount points as needed. In short, it only mounts a given share when that share is being accessed and are unmounted after a defined period of inactivity.

What is the main template file used by Autofs? ›

The Master Map File. The master configuration file for autofs is /etc/auto. master by default. Unless you have a good reason for changing this, leave it as the default.

Where are Autofs logs stored? ›

autofs debug information will be logged in /var/log/messages.

What are the disadvantages of a collision avoidance system? ›

Cons of Crash-Avoidance Systems
  • Cost. More safety seems like an obvious positive, but there can be some downsides to these advances. ...
  • Lack of understanding. ...
  • Distracted driving. ...
  • Repair problems.

What are the disadvantages of distance vector protocol? ›

Some of the advantages of distance vector algorithms are that they are simple, easy to implement, and use less memory and bandwidth. However, they also have some disadvantages, such as slow convergence, routing loops, and count-to-infinity problems.

What are the disadvantages of computational fluid dynamics? ›

CFD simulations may require frequent updates as the design evolves, which can add to the complexity and cost of the simulation process. Simulation time. CFD simulations can take a long time to run, especially for large and complex systems, which can be a disadvantage in time-critical design processes.

Top Articles
Four simple scalping trading strategies
What is RSI? - Relative Strength Index - Fidelity
Skyward Sinton
Design215 Word Pattern Finder
Instructional Resources
Craigslist Nj North Cars By Owner
Walgreens Alma School And Dynamite
Carter Joseph Hopf
Compare the Samsung Galaxy S24 - 256GB - Cobalt Violet vs Apple iPhone 16 Pro - 128GB - Desert Titanium | AT&T
Cvs Learnet Modules
Robert Malone é o inventor da vacina mRNA e está certo sobre vacinação de crianças #boato
My.doculivery.com/Crowncork
“In my day, you were butch or you were femme”
Tcgplayer Store
Buy PoE 2 Chaos Orbs - Cheap Orbs For Sale | Epiccarry
What Happened To Anna Citron Lansky
Mani Pedi Walk Ins Near Me
Patrick Bateman Notebook
Committees Of Correspondence | Encyclopedia.com
使用 RHEL 8 时的注意事项 | Red Hat Product Documentation
Directions To Advance Auto
Tygodnik Polityka - Polityka.pl
Divina Rapsing
Hanger Clinic/Billpay
20 Different Cat Sounds and What They Mean
MLB power rankings: Red-hot Chicago Cubs power into September, NL wild-card race
Iroquois Amphitheater Louisville Ky Seating Chart
Masterkyngmash
Filthy Rich Boys (Rich Boys Of Burberry Prep #1) - C.M. Stunich [PDF] | Online Book Share
Toothio Login
Craigslist Alo
Bay Area Craigslist Cars For Sale By Owner
Bolsa Feels Bad For Sancho's Loss.
Die 8 Rollen einer Führungskraft
Bidrl.com Visalia
Cosas Aesthetic Para Decorar Tu Cuarto Para Imprimir
Phoenixdabarbie
Craigslist Comes Clean: No More 'Adult Services,' Ever
Tracking every 2024 Trade Deadline deal
5 Star Rated Nail Salons Near Me
Mia Malkova Bio, Net Worth, Age & More - Magzica
Giantess Feet Deviantart
Moxfield Deck Builder
Atlantic Broadband Email Login Pronto
Helloid Worthington Login
Craigslist Pets Huntsville Alabama
How Does The Common App Work? A Guide To The Common App
Florida Lottery Claim Appointment
Courses In Touch
Cabarrus County School Calendar 2024
Sam's Club Gas Price Sioux City
Jackerman Mothers Warmth Part 3
Latest Posts
Article information

Author: Rueben Jacobs

Last Updated:

Views: 5687

Rating: 4.7 / 5 (77 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Rueben Jacobs

Birthday: 1999-03-14

Address: 951 Caterina Walk, Schambergerside, CA 67667-0896

Phone: +6881806848632

Job: Internal Education Planner

Hobby: Candle making, Cabaret, Poi, Gambling, Rock climbing, Wood carving, Computer programming

Introduction: My name is Rueben Jacobs, I am a cooperative, beautiful, kind, comfortable, glamorous, open, magnificent person who loves writing and wants to share my knowledge and understanding with you.