Instiq
Chapter 5 · File sharing services·v1.0.0·Updated 7/7/2026·~11 min

What's changed: Initial version (topic 2.11, subtopics 2.11.1–2.11.2)

5.2Configuring and Managing an NFS Server

Key points

Learn to configure and manage NFS for sharing filesystems among Unix/Linux clients: the export definition file /etc/exports, applying it with exportfs, checking exports from a client with showmount, monitoring activity with nfsstat, checking RPC services with rpcinfo, the roles of mountd and the portmapper, and mount options plus persistence/verification via /etc/fstab and /proc/mounts.

When Linux servers—or Unix-like clients—need to share a filesystem directly, NFS (Network File System) is the standard choice. Where Samba implements SMB/CIFS for Windows, NFS is the long-standing protocol of the Unix/Linux world, built on top of RPC (Remote Procedure Call).

5.2.1Defining and applying exports

  • Directories to export and their access conditions are written in /etc/exports (e.g., /srv/data 192.168.1.0/24(rw,sync,no_root_squash)), listing host specs and mount options per directory.
  • Editing /etc/exports alone does not take effect immediately. exportfs reloads/applies the export table (exportfs -ra re-exports everything; exportfs -v lists current exports).

5.2.2Verification, monitoring, and RPC

  • showmount (showmount -e server) lets a client check which directories are exported. nfsstat shows operational statistics (call counts, etc.) on the server.
  • Since NFS runs over RPC, rpcinfo (rpcinfo -p) — checking which RPC services are registered — is the standard first investigation for connectivity trouble. The portmapper (rpcbind) brokers the listening ports of RPC services, while mountd handles mount requests themselves.
  • Clients mount with mount (options set rw/ro, soft/hard mounts, etc.); persistence is written into /etc/fstab. The list of currently mounted filesystems can be checked via /proc/mounts (more reliably current than /etc/mtab).
Exam point

The four most frequent points: editing /etc/exports alone does not apply—run exportfs -ra, check exported directories from a client with showmount -e, verify RPC service registration with rpcinfo -p, check actual mount state via /proc/mounts. The division of labor—mountd handles mount requests, the portmapper brokers RPC ports—is another staple contrast.

Tracing the NFS operational flow organizes the commands. First, in /etc/exports you write one line per exported directory with its allowed hosts and options (rw = read-write, sync = synchronous writes, no_root_squash = respect the client's root privileges as-is). After editing, run exportfs -ra to apply—without it, the new settings take effect only after a service restart, if at all. To check "what is this server actually exporting" from a client, use showmount -e servername. When diagnosing a mount failure or slow response, remember that NFS runs on top of the RPC (Remote Procedure Call) mechanism. The portmapper (rpcbind) tracks each RPC service's listening port, and rpcinfo -p shows that registration status. Actual mount requests are handled by mountd, and the exchanges behind showmount and mount pass through it. Clients can mount temporarily with the mount command, but to auto-mount across reboots, write an entry into /etc/fstab such as server:/srv/data /mnt/data nfs defaults 0 0. To verify the actual current mount state reliably, check /proc/mounts/etc/mtab may be a symlink and can drift from reality, so /proc/mounts is the more trustworthy source. To keep an ongoing eye on server-side activity (RPC call counts, etc.), check statistics with nfsstat.

Command/elementRoleTypical use
/etc/exportsExport definition fileDefine shared dirs, hosts, options
exportfsApply the export tableRe-export all with exportfs -ra
showmountCheck exports from a clientshowmount -e server
rpcinfoCheck RPC service registrationrpcinfo -p for connectivity checks
mountd / portmapperHandle mounts / broker RPC portsRelay NFS requests
Warning

Trap: "editing /etc/exports takes effect for clients immediately" is wrong—you must apply it with exportfs -ra. Also wrong: "the portmapper directly handles mount requests"—mountd handles mount requests; the portmapper only brokers RPC service ports. And "the current mount status can be seen in /etc/fstab" is wrong—fstab is the persistent configuration (instructions for boot time); check /proc/mounts to see what is actually mounted right now.

The relationships among NFS's /etc/exports, exportfs, mountd/portmapper, and showmount/rpcinfo.
Apply with exportfs -ra; verify with showmount/rpcinfo

5.2.3Section summary

  • Export definitions in /etc/exports, applied with exportfs -ra. Verify from a client with showmount -e; check RPC registration with rpcinfo -p
  • mountd = handles mount requests, portmapper = brokers RPC ports. Persistent mounts in /etc/fstab; verify actual state via /proc/mounts

Sign in to track progress — Log in.

Quick check

(just a quick review)

Q1. You added a new shared directory to /etc/exports on an NFS server, but clients still cannot access it. Which command applies the change?

Q2. From a client, you want to check which directories a given NFS server currently exports. Which command is appropriate?

Q3. An NFS mount is failing, and you suspect the cause may be an unregistered RPC service. Which command should you check first?

Check your understandingPractice questions for Chapter 5: File sharing services

Keep track of your progress

The full study guide is free to read. Sign up free to practice with the question bank, track what you have read, review your mistakes, and highlight passages.