NFS Client Mounting and On-Demand automounting with autofs
In enterprise environments, centralized shared storage is exported over NFS. RHEL 9 supports mounting shares persistently via /etc/fstab and dynamically on-demand using autofs.
1. Manual and Persistent NFS Mounts
# Install NFS client utilities
dnf install -y nfs-utils
# Mount NFS export manually
mount -t nfs server1.example.com:/shares/data /mnt/data
# Persistent entry in /etc/fstab:
# server1.example.com:/shares/data /mnt/data nfs defaults,_netdev 0 0
[!NOTE] The
_netdevmount option tells systemd not to attempt mounting the network share until network connectivity is fully initialized during boot.
2. High-Yield Task: Dynamic Automounting with autofs
autofs mounts remote directories only when accessed and unmounts them automatically after an idle timeout, preventing hanging boot processes when remote servers are unreachable.
Step 1: Install and Enable autofs
dnf install -y autofs
systemctl enable --now autofs
Step 2: Configure Master Map File (/etc/auto.master.d/data.autofs)
# Mount base directory, Map file definition
/shares /etc/auto.shares --timeout=300
Step 3: Configure Map File (/etc/auto.shares)
# Subdirectory name, Mount options, Remote target
team -rw,sync server1.example.com:/export/team
Step 4: Restart and Verify
systemctl restart autofs
# Test access (sub-directory is created and mounted dynamically upon cd/ls)
cd /shares/team
df -hT .
Cross-references:
- See Logical Volume Manager (LVM) and Storage Administration for local storage and filesystem architectures.
- See User Management, Special Permissions, and POSIX Access Control Lists (ACLs) for permission models across shared network filesystems.