Domain 7System MaintenanceCORE

Managing Network Storage

Comprehensive guide to configuring NFS network storage, client mount configurations in /etc/fstab, autofs wildcard maps, and systemd network mount dependencies.

Domain: Deploy, configure, and maintain systems•Updated: 2026-08-30
#NFS#Autofs#Network Storage#Automount#RHCSA#RHEL

Managing Network Storage

Theory Questions

1. List shares offered by an NFS server.

  • Command(s):
showmount -e server2
  • Why: showmount -e queries the remote RPC mount daemon (rpc.mountd) on the specified NFS host and retrieves its export list.
  • Gotchas: showmount -e relies on RPC port 20048 (mountd) and port 111 (rpcbind). If the server strictly enforces NFSv4 without legacy RPC support or has port filters active, showmount may fail even if NFSv4 shares are accessible.
  • Verify:
showmount -e server2

2. Identify features that are and are not part of NFSv4.

  • Command(s):
rpcinfo -p server2
mount | grep nfs4
  • Why:

  • Part of NFSv4: Single TCP port operation (port 2049), integrated locking and mount protocols (no auxiliary lockd/mountd daemons), pseudo-filesystem export hierarchy, strong security options (Kerberos/RPCSEC_GSS), and stateful protocol operations.

  • NOT Part of NFSv4: UDP transport support (NFSv4 is strictly TCP), reliance on rpcbind (port 111), auxiliary RPC daemons (statd, lockd, mountd).

  • Gotchas: Attempting to configure legacy RPC ports or specifying udp in NFSv4 mount options will cause connection errors.

  • Verify:

nfsstat -c

3. Identify the package required to mount NFS shares on a client.

  • Command(s):
dnf install -y nfs-utils
  • Why: The nfs-utils package provides essential client-side helper utilities including /sbin/mount.nfs, showmount, nfsidmap, and key-management daemons required to handle NFS filesystems.
  • Gotchas: Attempting mount -t nfs ... on a minimal installation without installing nfs-utils yields mount: wrong fs type, bad option, bad superblock... errors.
  • Verify:
rpm -q nfs-utils

4. Diagnose why showmount -e returns no results.

  • Command(s):
# Check daemon status on server:
systemctl status nfs-server

# Check server firewall rules:
firewall-cmd --list-services

# Test RPC connectivity from client:
rpcinfo -p <server-ip>
  • Why: showmount -e fails when:
  1. nfs-server daemon is stopped or uninitialized.
  2. Firewall blocks RPC services (rpc-bind, mountd, or port 20048/111).
  3. No exports are defined in /etc/exports or /etc/exports.d/*.exports.
  4. The NFS server uses pure NFSv4 without running rpc.mountd.
  • Gotchas: Assuming showmount failure means NFS mounting is impossible; NFSv4 pseudo-root shares can often still be mounted directly even if showmount is blocked.
  • Verify:
mount -t nfs4 server2:/ /mnt

5. Identify the systemd service that provides NFS shares.

  • Command(s):
systemctl status nfs-server
  • Why: nfs-server.service manages kernel NFS server daemons (nfsd), exports tables, and coordination daemons on Enterprise Linux.
  • Gotchas: Confusing nfs-server.service with nfs-client.target or nfs-mountd.service. On the server side, nfs-server is the main service unit to enable.
  • Verify:
systemctl is-active nfs-server

6. Use the correct mount option in /etc/fstab for NFS shares.

  • Command(s) / Entry:
server2:/shares/data /mnt/data nfs defaults,_netdev,nfsvers=4 0 0
  • Why: The _netdev option instructs systemd to delay mounting the filesystem until network interfaces and network management services are active.
  • Gotchas: Omitting _netdev. If _netdev is missing, systemd attempts early boot mounting before network interfaces are online, causing system boot delays or drops into emergency mode.
  • Verify:
findmnt --verify
mount -a

7. Identify required and non-required steps in configuring automount.

  • Command(s):
dnf install -y autofs
systemctl enable --now autofs
  • Why:

  • Required Steps: Install autofs, configure master map (/etc/auto.master or /etc/auto.master.d/*.autofs), configure map files (/etc/auto.home), enable and start autofs.service.

  • Non-required Steps: Creating local target mount directories manually, editing /etc/fstab, pre-mounting NFS shares manually via mount.

  • Gotchas: Pre-creating target subdirectories inside an indirect automount directory. autofs creates and removes indirect subdirectories dynamically on demand.

  • Verify:

systemctl is-active autofs

8. Name the automount configuration file for a given directory.

  • Path / Command: Master Map Drop-in: /etc/auto.master.d/<name>.autofs Indirect Map File: /etc/auto.<name> (e.g., /etc/auto.home)
  • Why: System drop-in files under /etc/auto.master.d/*.autofs keep custom modular configurations clean and separate from global /etc/auto.master defaults.
  • Gotchas: Omitting the required .autofs extension on drop-in configuration files inside /etc/auto.master.d/.
  • Verify:
cat /etc/auto.master.d/home.autofs

9. Write a wildcard automount configuration line using NFS.

  • Command(s) / Entry: Inside map file (e.g., /etc/auto.home):
* -rw,sync,nfsvers=4 server2:/home/&
  • Why: * acts as a wildcard key matching any requested path access under the automount directory; & dynamically substitutes the matched key into the remote export path.
  • Gotchas: Hardcoding explicit usernames in the remote path field instead of using the ampersand & variable.
  • Verify:
cat /etc/auto.home

10. Identify the service that implements automount.

  • Command(s):
systemctl status autofs
  • Why: autofs.service manages the kernel automounter subsystem, reading map definitions and generating dynamic on-demand mount triggers upon directory access.
  • Gotchas: Service name is autofs, not automount.
  • Verify:
systemctl is-enabled autofs

11. Show available NFS mounts on a specific server.

  • Command(s):
showmount -e server2
  • Why: Sends RPC queries to server2 to display exported filesystems and allowed client subnet ACLs.
  • Gotchas: Hostname resolution failures; ensure server2 is resolvable via /etc/hosts or DNS.
  • Verify:
showmount -e server2

12. Mount an NFS share from a specific server.

  • Command(s):
mkdir -p /mnt/data
mount -t nfs -o nfsvers=4 server2:/shares/data /mnt/data
  • Why: Mounts remote exported filesystem server2:/shares/data directly to local directory /mnt/data.
  • Gotchas: Forgetting to create local target mount directory prior to running explicit mount commands.
  • Verify:
findmnt /mnt/data

13. Mount all NFS shares from a server to a local directory.

  • Command(s):
mkdir -p /mnt/nfs-root
mount -t nfs4 server2:/ /mnt/nfs-root
  • Why: NFSv4 exports an overarching pseudo-root filesystem (/). Mounting server2:/ mounts the top-level tree, exposing all underlying exported shares as subdirectories.
  • Gotchas: Attempting pseudo-root mounts on legacy NFSv3 servers (NFSv3 requires individual share mounts).
  • Verify:
ls -l /mnt/nfs-root

14. Ensure NFS shares mount only after network services have started.

  • Command(s) / Entry: In /etc/fstab:
server2:/shares/data /mnt/data nfs defaults,_netdev 0 0
  • Why: The _netdev mount flag forces systemd to insert explicit dependencies (Wants=network-online.target, After=network-online.target) into generated mount units.
  • Gotchas: Missing _netdev can cause boot failure or severe hangs during early system startup phases.
  • Verify:
systemctl show mnt-data.mount | grep -i "After"

15. Ensure changes to a mounted file system are written to the NFS server immediately.

  • Command(s) / Entry: In /etc/fstab or server export parameters:
server2:/shares/data /mnt/data nfs defaults,_netdev,sync 0 0
  • Why: sync forces synchronous I/O operations, ensuring data writes are committed to physical server storage before confirming execution back to calling applications.
  • Gotchas: Using async improves write performance by buffering in memory, but risks data loss during ungraceful server power cuts; sync prioritizes consistency.
  • Verify:
mount | grep "sync"

16. Identify autofs features not supported by systemd automount.

  • Key Features:
  1. Wildcard mapping (* key matching and & path substitution).
  2. Executable map scripts (dynamic programmatic map generation).
  3. Master map syntax parsing (/etc/auto.master).
  4. LDAP and NIS directory server map integrations.
  • Why: Systemd .automount units handle static individual mount targets, whereas autofs provides dynamic pattern matching for variable targets (such as dynamic user home directories).
  • Gotchas: Attempting to build wildcard dynamic home directory mounts using static systemd .automount files.
  • Verify:
man autofs

17. Identify the main automount configuration file.

  • Path / Command:
/etc/auto.master
  • Why: Main configuration entry point for autofs, controlling top-level base directories, mapping files, and lookup source pointers.
  • Gotchas: Adding dynamic user mapping lines straight into /etc/auto.master instead of delegating to secondary map files like /etc/auto.home.
  • Verify:
cat /etc/auto.master

18. Identify the automount service name.

  • Command:
systemctl status autofs
  • Why: autofs.service manages automount daemon processes.
  • Gotchas: Confusing autofs service name with automount.
  • Verify:
systemctl is-active autofs

19. Determine which firewall ports the automount client needs open.

  • Command(s):
# NFSv4 requires outbound TCP port 2049 on the client.
# If configuring server side firewalld:
firewall-cmd --permanent --add-service=nfs
firewall-cmd --reload
  • Why: NFSv4 operates across TCP port 2049. Clients initiate outbound connections to server port 2049.
  • Gotchas: Opening client inbound ports unnecessarily when standard client automount requires only outbound access to server port 2049.
  • Verify:
nc -zv server2 2049

Lab Tasks

Network Storage Practice

Task 1: Set up an NFS server that shares the /home directory on server2.

  • Command(s):
# Execute on server2:
# 1. Install NFS server utilities
dnf install -y nfs-utils

# 2. Configure export for /home
echo "/home *(rw,sync,no_root_squash)" > /etc/exports.d/home.exports

# 3. Start and enable nfs-server
systemctl enable --now nfs-server

# 4. Export the configured shares
exportfs -r

# 5. Configure firewalld rules
firewall-cmd --permanent --add-service=nfs
firewall-cmd --permanent --add-service=rpc-bind
firewall-cmd --permanent --add-service=mountd
firewall-cmd --reload
  • Why:

  • echo "/home ...": Shares /home directory with read-write (rw) privileges and synchronous disk operations (sync).

  • exportfs -r: Refreshes export table without restarting the NFS service.

  • firewall-cmd: Opens necessary firewall ports for client communication.

  • Gotchas:

  • Forgetting to run exportfs -r after creating files in /etc/exports.d/.

  • Omitting no_root_squash if remote root administrative write access is required for home directory setup.

  • Forgetting to make firewall rules --permanent.

  • Verify:

# Verify export table on server2:
exportfs -v

# Check NFS server service state:
systemctl is-active nfs-server

(Ensure persistent service execution across reboots via systemctl is-enabled nfs-server)


Task 2: Configure server1 to access the NFS-shared home directory using automount with wildcard automount configuration.

  • Command(s):
# Execute on server1:
# 1. Install autofs and nfs-utils
dnf install -y autofs nfs-utils

# 2. Create master map drop-in configuration
echo "/home /etc/auto.home" > /etc/auto.master.d/home.autofs

# 3. Create indirect wildcard mapping file
echo "* -rw,sync,nfsvers=4 server2:/home/&" > /etc/auto.home

# 4. Enable and start autofs service
systemctl enable --now autofs
  • Why:

  • /etc/auto.master.d/home.autofs: Maps accesses to /home to rules defined in /etc/auto.home.

  • * -rw,sync,nfsvers=4 server2:/home/&: Dynamic wildcard configuration where any user access attempt to /home/<username> triggers an on-demand NFSv4 mount of server2:/home/<username>.

  • systemctl enable --now autofs: Activates automounter service immediately and persists it across system reboots.

  • Gotchas:

  • Pre-creating user subdirectories inside /home on server1. autofs handles directory creation in memory dynamically; pre-existing physical directories block automount operations.

  • Forgetting the .autofs extension on /etc/auto.master.d/home.autofs.

  • Typing & incorrectly or forgetting the - before option strings (-rw,sync).

  • Verify:

# 1. Verify autofs service status:
systemctl status autofs

# 2. Test dynamic automounting (assuming user1 exists on server2:/home/user1):
cd /home/user1
df -hT /home/user1

(Output should show server2:/home/user1 mounted on /home/user1 with type nfs4)

  • Reboot Persistence Verification:
reboot
# Post-reboot check:
cd /home/user1
findmnt /home/user1

(Confirms autofs initializes on boot and mounts user home directories dynamically upon access)