From the NFS Server, do put in the command below. The NFS Server is 192.168.0.1 and the NFS Server port is 2049
# netstat -an | grep 192.168.0.1:2049
tcp 0 0 192.168.0.1:2049 192.168.0.10:965 ESTABLISHED
(192.168.0.10 is the client)
From the NFS Server, do put in the command below. The NFS Server is 192.168.0.1 and the NFS Server port is 2049
# netstat -an | grep 192.168.0.1:2049
tcp 0 0 192.168.0.1:2049 192.168.0.10:965 ESTABLISHED
(192.168.0.10 is the client)
Step 1: Do a Yum Install
# yum install nfs-utils rpcbind
Step 2: Enable the Service at Boot Time
# systemctl enable nfs-server # systemctl enable rpcbind # systemctl enable nfs-lock (it does not need to be enabled since rpc-statd.service is static.) # systemctl enable nfs-idmap (it does not need to be enabled since nfs-idmapd.service is static.)
Step 3: Start the Services
# systemctl start rpcbind # systemctl start nfs-server # systemctl start nfs-lock # systemctl start nfs-idmap
Step 4: Confirm the status of NFS
# systemctl status nfs
Step 5: Create a mount point
# mkdir /shared-data
Step 6: Exports the Share
# vim /etc/exports /shared-data 192.168.0.0/16(rw,no_root_squash)
Step 7: Export the Share
# exportfs -rv
Step 8: Restart the NFS Services
# systemctl restart nfs-server
Step 9: Configure the Firewall
# firewall-cmd --add-service=nfs --zone=internal --permanent # firewall-cmd --add-service=mountd --zone=internal --permanent # firewall-cmd --add-service=rpc-bind --zone=internal --permanent
References:
nconnect is included in linux kernel versions >= 5.3. What is nconnect? nconnect enables multiple TCP connections for a single NFS mount. It is easy to implement
At /etc/fstab
mount -t nfs -o rw,nconnect=16 192.168.1.0:/applications /user/local
References:
If you have encountered issues like
mount.nfs: requested NFS version or transport protocol is not supported
OR
mount.nfs4: Protocol not supported
Mount with NFS version 3 (with 4 verbose flags)
% mount -vvvv -t nfs -o vers=3 nfs-server:/share /mnt/nfs
1. Assuming this is your mount command
mount -t nfs -o vers=3 XXX.XXX.XXX.XXX:/myserver/nfs /myclient/nfs
2. And if you are using showmount command from an NFS client and the following are observed
clnt_create: RPC: Program not registered
3. You have to access the NetApp Storage to check the NFS Protocol is enabled. I’m using the Netapp OnCommand System Manager
4. Check that the NFS Client can mount.
showmount --no-headers -e nfs_server / (everyone)
References:
The write-up is taken from RedHat Using nfsstat and nfsiostat to troubleshoot NFS performance issues on Linux
NFS relies on the existing network infrastructure, any glitches on the network may affect the performance of the connection. One of the tools that can be used is nfsstat
% yum install nfs-utils
The nfsstat command displays statistical information about the NFS and Remote Procedure Call (RPC) interfaces to the kernel.
% nfsstat -s
Server rpc stats: calls badcalls badclnt badauth xdrcall 107310012 0 0 0 0
The most important field to check is the badcalls, which represents the total number of calls rejected by the RPC layer. When the badcalls is greater than 0, than the underlying network needs to be checked, as there might be latency.
% nfsstat -c
Client rpc stats: calls retrans authrefrsh 23158 0 23172 Client nfs v3: null getattr setattr lookup access readlink 0 0% 7237 31% 7 0% 1443 6% 7874 34% 11 0% read write create mkdir symlink mknod 578 2% 4548 19% 585 2% 1 0% 0 0% 0 0% remove rmdir rename link readdir readdirplus 0 0% 0 0% 0 0% 0 0% 0 0% 51 0% fsstat fsinfo pathconf commit 25 0% 10 0% 5 0% 781 3%
The client is doing well as it has relatively few retransmission requests. If you are encountering excessive retransmissions, you may want to adjust data transfer buffer sizes, which are specified by the mount command options rsize and size.
Check dropped packet by running the following command on both the server and the client:
% nfsstat -o net Client packet stats: packets udp tcp tcpconn 0 0 0 0
strace is a wonderful tool to trace system calls and signals
I was hanging issues whenever I do a “df” and I was curious which file system is calling issues
strace df ..... .....
stat("/run/user/1304561586", {st_mode=S_IFDIR|0700, st_size=40, ...}) = 0 stat("/run/user/17132623", {st_mode=S_IFDIR|0700, st_size=40, ...}) = 0 stat("/run/user/17149581", {st_mode=S_IFDIR|0700, st_size=40, ...}) = 0 stat("/run/user/1304565184", {st_mode=S_IFDIR|0700, st_size=60, ...}) = 0 stat("/scratch",
It is obvious that /scratch file hang immediately after being launched.