NFS Command Guide

I’ve been doing a large amount amount of work with NFS clients and severs over the past few days and thought it may be wise to note down some useful commands.

For reference, the NFS Server is Windows Server 2012 R2 and the client is CentOS 7.

To view NFS exports on a server

[root@rsync01 ~]# showmount -e
Export list for

To manually mount an NFS share

mount -t nfs /data/NFS1/

To manually mount an NFS share using NFS version 4.1

mount -t nfs /data/NFS1/ -o nolock,nfsvers=4.1

To determine which version of NFS the server is offering and over which transport protocol

[root@rsync01 ~]# rpcinfo
   program version netid     address                service    owner
    100003    2    tcp            nfs        superuser
    100003    3    tcp            nfs        superuser
    100003    2    udp            nfs        superuser
    100003    3    udp            nfs        superuser
    100003    2    tcp6      ::.8.1                 nfs        superuser
    100003    3    tcp6      ::.8.1                 nfs        superuser
    100003    2    udp6      ::.8.1                 nfs        superuser
    100003    3    udp6      ::.8.1                 nfs        superuser
    100003    4    tcp            nfs        superuser
    100003    4    tcp6      ::.8.1                 nfs        superuser

To view the current mounts and which version of NFS is used

[root@rsync01 ~]# df -hT
Filesystem                           Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos_hc3--rsync01-root xfs        18G  1.8G   16G  10% /
devtmpfs                             devtmpfs  912M     0  912M   0% /dev
tmpfs                                tmpfs     921M     0  921M   0% /dev/shm
tmpfs                                tmpfs     921M   20M  901M   3% /run
tmpfs                                tmpfs     921M     0  921M   0% /sys/fs/cgroup
/dev/sda1                            xfs       497M  184M  313M  37% /boot                    nfs4       26T  271G   26T   2% /data/NFS1

To automatically mount an NFS share on boot - edit /etc/fstsab /data/NFS1 nfs defaults 0 0