The automounter is still used in Red Hat Enterprise Linux (RHEL) 9.4, but it has been modernized and is typically implemented using the autofs service. The automounter is a system tool that allows automatic mounting and unmounting of file systems on demand, which is particularly useful in environments with shared resources like NFS (Network File System). Here are some key points about the automounter in RHEL 9.4:
Autofs Package:
The automounter functionality is provided by the autofs package.
You can verify its installation with:
rpm -q autofs
If it's not installed, you can add it with:
sudo dnf install autofs
Configuration:
The primary configuration file for autofs is located at /etc/auto.master. Additional mount points can be defined in separate map files. For example:
/etc/auto.master might include:
/mnt/nfs /etc/auto.nfs
/etc/auto.nfs could map specific directories to NFS shares.
When a file system is accessed (e.g., navigating into a directory), the automounter will mount it.
If the file system is idle for a configured timeout period, the automounter will unmount it.
Modern Alternatives:
While autofs is still widely used, newer technologies like systemd.automount units can also provide similar functionality with integration into the systemd ecosystem.
RHEL Documentation:
Red Hat's official documentation includes guides for configuring and managing autofs in RHEL 9.4.
amd vs. autofs
The two Linux automounters that can be configured and used on the Red Hat Linux system are:
autofs
systemd.automount
amd is not an automounter, but a package manager for AMD64 systems. autofs is the traditional automounter for Linux. It has been around for many years and is very powerful and flexible. However, it can be complex to configure.
systemd.automount is a newer automounter that is integrated with the systemd system and service manager.
It is simpler to configure than autofs, but it is not as powerful. Which automounter you choose depends on your needs and preferences. If you need a powerful and flexible automounter, autofs is a good choice. If you need a simpler and easier-to-configure automounter, systemd.automount is a good choice.
Here is a table comparing the two automounters:
Feature
autofs
systemd.automount
Maturity
Mature
Newer
Power and flexibility
Powerful and flexible
Less powerful and flexible
Complexity
Complex to configure
Simpler to configure
Integration with systemd
Not integrated
Integrated
Automounters in Red Hat Linux
On Red Hat Linux, two commonly used automounters can be configured and used.
Autofs
Description: Autofs is the most commonly used automounter in Red Hat Linux. It dynamically mounts file systems as they are accessed and unmounts them when they are no longer in use, based on a configurable timeout period.
Features:
Works with NFS, CIFS, and other file systems.
Configuration is done through /etc/auto.master and associated map files.
Can handle both direct and indirect mappings for file system mounts.
Description: Starting with systemd-based distributions, systemd.automount units can also be used as an automounter. This approach integrates tightly with the systemd ecosystem.
Features:
Uses .automount and .mount unit files for configuration.
Provides on-demand mounting and unmounting similar to autofs.
Ideal for modern environments where systemd is already managing other services and resources.
Relevant Commands:
Example to create an automount unit:
sudo nano /etc/systemd/system/mnt-nfs.mount
Unit file content:
[Unit]
Description=NFS mount
After=network.target
[Mount]
What=server:/export
Where=/mnt/nfs
Type=nfs
[Install]
WantedBy=multi-user.target
Both solutions can be used effectively, depending on the system's requirements and the administrator's preference.
amd and autofs. amd is user-level and requires no kernel support; autofs requires kernel support, but is simpler to administer. autofs kernel support is built into the stock kernel installed by the Red Hat Linux distribution.
However, the autofs RPM must be installed and local configuration may be required.
map file definition: "in automounter parlance, a configuration file that associates a directory key with a device to mount when that directory key is accessed."
autofs has a master configuration file and a second type of configuration file, a map file for each autofs filesystem mount point.
autofs master file | Entry in /etc/auto.master
The master configuration file /etc/auto.master contains the overall automount configuration, illustrated in the following diagram.
This is the mount point, the location where the autofs filesystem associated with map will be mounted on the local filesystem, in this case, /misc
This is the map file associated with the autofs filesystem. The map file contains entries for the devices to be mounted on the mount point
These are options associated with all the devices listed in the map file. In this case, all devices listed in /etc/auto.misc automatically will be unmounted after 60 seconds of disuse
autofs map file
The map file /etc/auto.misc has entries such as the following:
Entry in /etc/auto.misc
AMD
amd is the file system automounter daemon. It automatically mounts an unmounted file system whenever a file or directory within that file system is accessed. File systems are automatically unmounted again after a period of disuse. This file is where you would add amd options to be run every time by amd. Options include specifying where amd activity should be logged, and specifying how long amd should wait before umounting an idle file system.
The mount point used to access the device. In this case, /misc/cd.
Mounting options. In this case, the drive is configured for standard, read-only CD-ROMS.
The location of the filesystem to mount. In this case, it is the local CD-ROM drive, cdrom. The colon indicates that the drive is a local device.
The mount point used to access the device. In this case, /misc/floppy.
Mounting options. In this case, the drive is configured to automatically recognize the type of disk and mount it appropriately. For example, a floppy can be formatted for DOS or Linux.
The location of the filesystem to mount. In this case, it is the first local floppy drive, fd0.The colon indicates that the floppy is a local device.
Other options
/etc/rc.d/init.d/autofs status
will report the status and location of all automounter active mount points. Other options that can be used with autofs include start, stop, and reload, which perform the obvious actions. For example,
/etc/rc.d/init.d/autofs stop
will stop the automounter and deactivate any currently active automatic mount points.
If you make changes to the automounter, you should reboot to verify that it comes up. If it fails, you should make autofs automatically run with the command chkconfig, add autofs.
SettingUp Automounter
The following paragraph checks your understanding of how to set up the automounter.
Setting up automounter
This exercise asked you to simulate the process required to install and configure the automounter to automount your CD-ROM and make it accessible at
/local_cd
.
The following screen illustrates the results.
File systems
Kernel automounter version 4 support (also supports v3) N
Ext3 journalling file system support
The next lesson describes network file synchronization.