nfsstat Command

This command displays statistical information about NFS and RPC connections. Use the following syntax to display NFS server and client statistics:

nfsstat [-cmnrsz]
-c

Displays client-side information

-m

Displays statistics for each NFS-mounted file system

-n

Displays the NFS information on both the client side and the server side

-r

Displays RPC statistics

-s

Displays the server-side information

-z

Specifies that the statistics should be set to zero

If no options are supplied, the -cnrs options are used.

Gathering server-side statistics can be important for debugging problems when new software or new hardware is added to the computing environment. Running this command a minimum of once a week, and storing the numbers, provides a good history of previous performance.

Example 6-1 Displaying NFS Server Statistics

# nfsstat -s

Server rpc: 
Connection oriented: 
calls   badcalls   nullrecv   badlen     xdrcall    dupchecks  dupreqs 
11459   0          0          0          0          0          0 
Connectionless: 
calls   badcalls   nullrecv   badlen     xdrcall    dupchecks  dupreqs 
0       0          0          0          0          0          0 

Server NFSv2: 
calls      badcalls   referrals  referlinks
0          0          0          0 

Server NFSv3: 
calls      badcalls   referrals  referlinks
0          0          0          0 

Server NFSv4: 
calls      badcalls   referrals  referlinks
11456      3          0          8 
Version 2: (0 calls)
null     getattr  setattr  root     lookup   readlink read     wrcache  
0 0%     0 0%     0 0%     0 0%     0 0%     0 0%     0 0%     0 0% 
write    create   remove   rename   link     symlink  mkdir    rmdir
0 0%     0 0%     0 0%     0 0%     0 0%     0 0%     0 0%     0 0% 
readdir  statfs 
0 0%     0 0% 
Version 3: (0 calls)
null        getattr     setattr     lookup      access   readlink 
0 0%        0 0%        0 0%        0 0%        0 0%     0 0% 
read        write       create   mkdir       symlink     mknod 
0 0%        0 0%        0 0%     0 0%        0 0%        0 0% 
remove     rmdir       rename      link        readdir     readdirplus 
0 0%       0 0%        0 0%        0 0%        0 0%        0 0% 
fsstat      fsinfo      pathconf    commit 
0 0%        0 0%        0 0%        0 0% 
Version 4.0: (10617 calls)
null                compound 
775 7%              9842 92% 
Version 4.0: (42291 operations) 
reserved        access             close 
0 0%            498 1%             28 0% 
commit          create             delegpurge 
14 0%           270 0%             0 0% 
delegreturn     getattr            getfh 
0 0%            4709 11%           5841 13% 
link            lock               lockt 
22 0%           74 0%              25 0% 
locku           lookup             lookupp 
24 0%           10192 24%          9 0% 
nverify         open               openattr 
106 0%          1248 2%            0 0% 
open_confirm    open_downgrade     putfh 
1174 2%         14 0%              4328 10%
putpubfh        putrootfh            read 
2 0%            7607 17%             20 0%
readdir         readlink             remove 
92 0%           8 0%                 1472 3%
rename          renew                restorefh 
35 0%           9 0%                 9 0%
savefh          secinfo              setattr 
64 0%           6 0%                 1792 4%
setclientid     setclientid_confirm  verify 
1234 2%         1228 2%              106 0%
write           release_lockowner 
30 0%           1 0% 
Version 4.1: (827 calls)
null                 compound 
0 0%                 827 100% 
Version 4.1: (1561 operations) 
reserved              access               close 
0 0%                  0 0%                 10 0% 
commit                create               delegpurge
0 0%                  6 0%                 0 0% 
delegreturn           getattr              getfh 
7 0%                  3 0%                 63 4% 
link                  lock                 lockt 
0 0%                  2 0%                 0 0% 
locku                 lookup                lookupp 
2 0%                  262 16%               10 0% 
nverify               open                  openattr 
0 0%                  47 3%                 0 0% 
open_confirm          open_downgrade        putfh 
0 0%                  0 0%                  31 1% 
putpubfh              putrootfh            read 
0 0%                  150 9%               3 0% 
readdir               readlink             remove 
3 0%                  0 0%                 7 0% 
rename                renew                restorefh 
2 0%                  0 0%                 0 0% 
savefh                secinfo              setattr 
1 0%                  0 0%               8 0% 
setclientid           setclientid_confirm  verify 
0 0%                  0 0%                 1 0% 
write                 release_lockowner    backchannel_ctl 
6 0%                  0 0%                 1 0% 
bind_conn_to_session  exchange_id          create_session 
1 0%                  267 17%              223  14% 
destroy_session       free_stateid         get_dir_delegation 
17 1%                 1 0%                 0 0%
getdeviceinfo         getdevicelist        layoutcommit 
0 0%                  0 0%                 0 0%
layoutget             layoutreturn         secinfo_no_name 
0 0%                  0 0%                 3 0%
sequence              set_ssv              test_stateid 
321 20%               0 0%                 4 0%
want_delegation       destroy_clientid     reclaim_complete 
0 0%                  12 0%                87 5% 
illegal
0 0% 

Server nfs_acl: 
Version 2: (0 calls) 
null        getacl      setacl      getattr     access      getxattrdir 
0 0%        0 0%        0 0%        0 0%        0 0%        0 0% 
Version 3: (0 calls) 
null        getacl      setacl      getxattrdir 
0 0%        0 0%        0 0%        0 0% 

The example shows how to display the statistics for RPC and NFS activities. In both sets of statistics, knowing the average number of badcalls or calls and the number of calls per week can help identify a problem. The badcalls value reports the number of bad messages from a client. This value can indicate network hardware problems.

Some of the connections generate write activity on the disks. A sudden increase in these statistics could indicate trouble and should be investigated. For NFS Version 2 statistics, the connections to note are setattr, write, create, remove, rename, link, symlink, mkdir, and rmdir. For NFS Version 3 and NFS Version 4 statistics, the value to watch is commit. If the commit level is high in one NFS server compared to another almost identical server, check that the NFS clients have enough memory. The number of commit operations on the server grows when clients do not have available resources. This example displays the statistics for both NFS Version 4.0 and NFS Version 4.1.