Lab activity

AutoFS and NFS Client Mounts

Learn how to configure NFS exports and automate network filesystem mounts using AutoFS, including indirect and direct maps, firewall, and SELinux settings.

Overview

In this lab, we will learn how to configure an NFS export and mount it automatically using AutoFS. We will configure the NFS server, prepare the exported directory, configure firewall and SELinux settings, and verify the NFS share with a manual mount. You will then configure both indirect and direct AutoFS maps so the NFS share is mounted on demand when the mount point is accessed. By the end of this lab, you will understand how NFS and AutoFS work together to provide efficient, on-demand network filesystem mounts.

Learning Outcomes

  • Understand how to configure and export an NFS share.
  • Configure firewall services required for NFS communication.
  • Configure the SELinux boolean required for read-write NFS exports.
  • Verify an NFS export using a manual mount before configuring AutoFS.
  • Configure an indirect AutoFS map for on-demand NFS mounting.
  • Configure a direct AutoFS map using the /- master map entry.
  • Verify and troubleshoot AutoFS mounts using system commands and logs.

Key Concepts

  • NFS: A network filesystem that allows systems to access shared directories over a network.
  • NFS Export: A directory made available to clients through the NFS server configuration in /etc/exports.
  • AutoFS: An automounting service that mounts network filesystems on demand when they are accessed and unmounts them after a period of inactivity.
  • Indirect Map: An AutoFS configuration where shares are mounted below a common parent directory using keys defined in the map file.
  • Direct Map: An AutoFS configuration where the complete mount path is specified directly in the map file and registered using /-.
  • SELinux Boolean: A configurable SELinux setting that controls whether specific system operations are permitted, such as read-write NFS exports.
  • AutoFS Timeout: The period of inactivity after which an automatically mounted filesystem can be unmounted.

Why Needed?

  • On-Demand Mounting: Automatically mounts NFS shares only when they are accessed.
  • Efficient Resource Usage: Automatically unmounts inactive network filesystems instead of keeping them mounted permanently.
  • Centralized File Sharing: Allows systems to access shared data through NFS without maintaining local copies.
  • Improved Reliability: Verifying the NFS server, firewall, SELinux, and mount configuration separately helps identify configuration problems.
  • Flexible Mount Configuration: Supports both indirect and direct AutoFS maps for different filesystem mounting requirements.