The nfsstat
command is used to display the statistics of the NFS (Network File System) server and client. It provides information about the NFS client and server status, including the number of RPC (Remote Procedure Call) requests, the number of failed requests, and the number of bytes transmitted.
Overview
The nfsstat
command displays the following information:
- The number of bytes read/written by the NFS client and server
- The number of RPC requests sent and received by the NFS client and server
- The number of failed RPC requests
- The number of times the NFS client and server have retransmitted requests
- The number of times the NFS client and server have timed out waiting for a response
Examples
To display the NFS client and server statistics, simply run the nfsstat
command:
nfsstat
This will display the following output:
Server rpc stats:
calls badcalls badclnt badauth xdrcall
0 0 0 0 0
Server nfs v3:
null getattr setattr lookup access readlink
0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
Server nfs v4:
null compound
0 0% 0 0%
Client rpc stats:
calls retrans authrefrsh
0 0 0
Client nfs v3:
null getattr setattr lookup access readlink
0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
Client nfs v4:
null compound open close setattr fsinfo
0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
This output shows the statistics for both the NFS server and client. The Server rpc stats
section shows the number of RPC calls, bad calls, bad clients, bad authentication attempts, and XDR calls. The Server nfs v3
and Server nfs v4
sections show the number of NFS version 3 and 4 calls for each type of operation.
The Client rpc stats
section shows the number of RPC calls, retransmissions, and authentication refreshes for the NFS client. The Client nfs v3
and Client nfs v4
sections show the number of NFS version 3 and 4 calls for each type of operation.
Options
The following table lists the available options for the nfsstat
command:
Option | Description |
---|---|
-c | Continuously display the NFS statistics. |
-o | Display the NFS statistics in an optimized format. |
-s | Display the NFS statistics for a specific interval of time. |
Troubleshooting Tips
If you are experiencing issues with NFS, the nfsstat
command can be useful in identifying the problem. Here are some tips for troubleshooting common issues:
- If you see a high number of retransmissions in the
Client rpc stats
section, it may indicate network congestion or a slow server. Try increasing thersize
andwsize
mount options to improve performance. - If you see a high number of failed RPC requests in the
Server rpc stats
section, it may indicate a problem with the NFS server. Check the server logs for errors or try restarting the NFS service. - If you see a high number of timed-out requests in the
Server rpc stats
section, it may indicate that the NFS server is overloaded. Try reducing the number of NFS clients or increasing the server resources.
Notes
- The
nfsstat
command is available on most Linux distributions and is typically included in thenfs-utils
package. - The output of the
nfsstat
command can be difficult to interpret, especially for users who are not familiar with NFS. It is recommended to consult the NFS documentation or seek assistance from a qualified Linux administrator if you are unsure about the meaning of the statistics.