Monday, March 14, 2016

NFS Commands 101

Refer to previous article Setup File Sharing with NFS on Centos Linux.

I find NFS version 3 is the most commonly used and uses remote procedure call (RPC) to manage connection between client and server. The service called rpcbind in Centos 6 has replaced portmap to handle RPC (see nfs4). Version 3 onward support files larger than 2 Gb size.

Whenever an NFS server is restarted not gracefully, the service rpc.statd notifies NFS clients. When quota is applied to the NFS, the service rpc.rquotad handles quota information.

The file /etc/exports define which directories are available to NFS clients. Each share is placed on a separate line and it indicates which client can access along with the options. Default users access a share as the user nobody, where this can be overridden in the /etc/exports option.

E.g. The following /etc/exports shares the directory /data with the client The client may read and write and mounts synchronously.


Or user connect as its own user


Default ports used by NFS are 2049 for the NFS service and 111 for RPC service.

Here are a list of NFS version 3 commands. Most are at the client side unless specified.

General NFS Commands

Start and stop NFS service
# service nfs start
# /etc/init.d/nfs start
# service nfs stop

Enable NFS service at boot
#chkconfig nfs on

Refresh NFS server shares from /etc/exports
# exportfs -r

Unload and reload NFS shares from /etc/exports
# export -a

Check support for NFS on the kernel. Did you forget to compile kernel with NFS support?
# lsmod |grep nfs
# grep -i nfs /boot/config

Check if list of commands are running
# rpcinfo -p

Display NFS statistics as client
# nfsstat -c

Display use of io
# vmstat -s

Mounting NFS

Display available NFS mounts
# showmount -e servername

Mount an NFS share
# mount -t nfs servername:/the/sharename

Display if the NFS mount is full or its free space
# df -k

Troubleshoot reference

No comments:

Blog Archive