How to reload NFS exports

NFS export edits are saved in /etc/exports or /etc/exports.d, but clients use the active export table built from those files. Reloading exports after an edit applies changed client selectors, paths, and options without restarting the NFS service for ordinary export-line changes.

The exportfs command applies saved export definitions. The -r mode rebuilds the export table from /etc/exports and files ending in .exports under /etc/exports.d, then removes active entries that were deleted from the saved configuration.

Use this after changing export options such as rw, ro, root_squash, sync, or a client network. The finished state is not the saved file alone; sudo exportfs -v should show the expected export path, client selector, and option set in the active table.

Steps to reload NFS exports:

  1. Check the active export table before editing when the server already exports the path.
    $ sudo exportfs -v
    /srv/nfs/projects
    		192.0.2.0/24(sync,wdelay,hide,no_subtree_check,sec=sys,rw,root_squash,no_all_squash)

    The active table can differ from the saved file if an earlier change was not reloaded or if an export was added manually with exportfs.

  2. Edit the saved export definition.
    $ sudo vi /etc/exports.d/projects.exports

    Use /etc/exports for simple servers, or a drop-in under /etc/exports.d when separate files make service ownership clearer. Files under /etc/exports.d must end with .exports to be read by exportfs.

  3. Save the intended export line.
    /srv/nfs/projects 192.0.2.0/24(ro,sync,no_subtree_check)

    Keep the client selector directly attached to its option list. A space between the host or network and the parenthesized options changes the meaning of the export line.

  4. Reload the export table from the saved files.
    $ sudo exportfs -rv
    exporting 192.0.2.0/24:/srv/nfs/projects

    Use exportfs -r after removing or narrowing an export. It synchronizes the active table with the saved files instead of only adding exports listed in the configuration.

  5. Verify that the active table now shows the changed option set.
    $ sudo exportfs -v
    /srv/nfs/projects
    		192.0.2.0/24(sync,wdelay,hide,no_subtree_check,sec=sys,ro,root_squash,no_all_squash)

    The example changed the export from rw to ro. For an access-control change, also confirm the client selector is the expected host, subnet, netgroup, or wildcard pattern.

  6. Fix any exportfs warning before treating the reload as complete.

    A warning about the path, client selector, or option list means the saved file still needs correction. Do not use exportfs -a to hide a failed reload after deleting or tightening an export.

  7. Restart NFS services only when the daemon configuration changed, not for ordinary export-file edits.
    $ sudo systemctl restart nfs-server.service

    Export definitions normally use sudo exportfs -rv. Service restarts are for changes to NFS daemon settings, package-level configuration, or a service state problem outside the export table.