8.6. Starting and Stopping NFS

To run an NFS server that is not configured to use only NFSv4, the rpcbind[1] service must be running. To verify that rpcbind is active, use the following command:
# systemctl status rpcbind
If the rpcbind service is running, then the nfs service can be started. To start an NFS server, use the following command:
# systemctl start nfs
To enable NFS to start at boot, use the following command:
# systemctl enable nfs-server

Note

For NFSv3, if NFS is set to start at boot time, the nfs-lock service needs to be enabled. On Red Hat Enterprise Linux 7.1 and later, nfs-lock starts automatically if needed, and an attempt to enable it manually fails. On Red Hat Enterprise Linux 7.0, check the status by running systemctl status nfs-lock. If nfs-lock is not enabled, run systemctl start nfs-lock. To set nfs-lock to automatically start on boot on Red Hat Enterprise Linux 7.0, run systemctl enable nfs-lock.
To stop the server, use:
# systemctl stop nfs
The restart option is a shorthand way of stopping and then starting NFS. This is the most efficient way to make configuration changes take effect after editing the configuration file for NFS. To restart the server type:
# systemctl restart nfs
After you edit the /etc/sysconfig/nfs file, restart the nfs-config service by running the following command for the new values to take effect:
# systemctl restart nfs-config
The try-restart command only starts nfs if it is currently running. This command is the equivalent of condrestart (conditional restart) in Red Hat init scripts and is useful because it does not start the daemon if NFS is not running.
To conditionally restart the server type:
# systemctl try-restart nfs
To reload the NFS server configuration file without restarting the service type:
# systemctl reload nfs