How to Check NFS Version from Linux Command Line

Network File System (NFS) is a distributed file system protocol that allows a user on a system (client) to access files over a network in a manner similar to how local storage is accessed. In one of our earlier tutorials, we learned nfs mount option in detail. Mainly there are 3 versions of NFS are currently available which are NFS v2, NFS v3 and NFS v4.

In this tutorial, I will show you how to check NFS version that a server or client running on Linux. We can use the command nfsstat to find the NFS version of the server/client.

1) Check NFS server version using nfsstat command

Nfsstat command can be used as follows.

# nfsstat –s

-s : Print only server-side statistics. The default is to print both server and client statistics.

Sample Output could be,

Server nfs:
calls badcalls public_v2 public_v3
4330692 0 0 0
Version 2: (0 calls)
null getattr setattr root lookup readlink
read
0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
0 0%
wrcache write create remove rename link
symlink
0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
0 0%
mkdir rmdir readdir statfs
0 0% 0 0% 0 0% 0 0%
Version 3: (4330692 calls)
null getattr setattr lookup access readlink
read
197 0% 2569161 59% 166 0% 93521 2% 222594 5% 120 0%
1218751 28%
write create mkdir symlink mknod remove
rmdir
163494 3% 414 0% 543 0% 0 0% 0 0% 10 0%
0 0%
rename link readdir readdir+ fsstat fsinfo
pathconf
1 0% 0 0% 550 0% 45434 1% 15285 0% 177 0%
1 0% commit 273 0%

From the activity, you can find that the server is using NFS v3.

Find NFS statistics

Now let's see few other options of nfsstat command to find NFS statistics

Show all information about all versions (2 , 3 and 4) of NFS.

nfsstat -o all -234
or
nfsstat --verbose -234

Show all information about active versions of NFS

nfsstat -o all

2) Find NFS client version

This can be found as follows.

# nfsstat –c

-c, --client : Print only client-side statistics.

Sample output could be

Client nfs:
calls badcalls clgets cltoomany
753081 28 753081 0
Version 2: (0 calls)
null getattr setattr root lookup readlink
0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
read wrcache write create remove rename
0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
link symlink mkdir rmdir readdir statfs
0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
Version 3: (748700 calls)
null getattr setattr lookup access readlink
0 0% 140588 18% 61939 8% 184611 24% 150266 20% 8 0%
read write create mkdir symlink mknod
35415 4% 58540 7% 11703 1% 562 0% 248 0% 0 0%
remove rmdir rename link readdir readdirplus
3264 0% 0 0% 9 0% 0 0% 1165 0% 1219 0%
fsstat fsinfo pathconf commit
33435 4% 7160 0% 3309 0% 55259 7%

Read Also:

Bobbin Zachariah 7:17 pm

Comments

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.