Skip to main content

Remove Unused NFS

To remove or delete an unused NFS export entry that you no longer need, you can follow these steps:

Identify the Export Entry

First, identify the export entry you want to remove by running exportfs -v with sudo:

sudo exportfs -v

This command will list all the NFS exports currently configured on your system.

Remove the Export Entry

To remove an NFS export entry, you use the exportfs command with the -u option followed by the path of the export. Here’s the general syntax:

sudo exportfs -u [options] export_path
  • Replace export_path with the path you want to remove from the NFS exports.
  • -u option is used to unexport (remove) the specified export path.

For example, if you see an export like /mnt/nfs_share *(rw,fsid=0,sync,no_subtree_check) that you want to remove, you would use:

sudo exportfs -u /mnt/nfs_share

Restart NFS Service

Restart NFS Service: After removing the export entry, restart the NFS server to apply changes:

sudo systemctl restart nfs-server

Verify Removal

After running the exportfs -u command, you can verify that the export entry has been removed by running exportfs -v again:

sudo exportfs -v

The entry you removed should no longer appear in the list of NFS exports.

Additional Notes

  • Make sure to review the list of NFS exports carefully before removing any entry to avoid unintentionally deleting important configurations.
  • Changes made with exportfs are immediate and affect NFS clients accessing the exports. Ensure any necessary changes are communicated if NFS exports are actively used.

By following these steps, you can effectively remove an unused NFS export entry from your system using exportfs on Ubuntu or any Linux distribution that supports NFS.