1. Overview

Network File System (NFS) is a widely used protocol for file sharing in Linux and other Unix-like operating systems. When working with NFS, it’s usually important to determine the version of NFS that an NFS server is using. This is to ensure compatibility and optimize performance.

In this tutorial, we’ll explore various methods to check the NFS version of an NFS server in a Linux environment.

2. Using the showmount Command

The showmount command provides information about NFS exports on a server, including the version of NFS being used. Further, it provides various options that are useful for obtaining more detailed NFS export data like the protocol version.

Let’s start by listing all NFS mounts of our local server:

$ showmount -a
All mount points on
/export/share (sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash) - NFSv3
/export/home  (sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash) - NFSv4

In the above example, the -a option displays all the mount points or exports on an NFS server, including those that are currently not in use. Furthermore, showmount provides a comprehensive list of all the exported directories, along with their associated NFS version and other options. In essence, this NFS server has two exports, with /export/share using NFS version 3 (NFSv3) and /export/home using NFS version 4 (NFSv4).

On the other hand, if we need to display the specific mount points on an NFS server that’s currently active and available for mounting by NFS clients, we use the -e option instead:

$ showmount -e --verbose
Exports list for
/export/share (sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash) - NFSv3
  Hosts allowed:,
/export/home  (sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash) - NFSv4
  Hosts allowed: *

The –verbose flag provides additional details about the NFS exports, including the NFS version as well as the hosts allowed to access each export. Moreover, we specified the NFS server IP address in the command instead of leaving the implicit local machine check. The output shows us that the NFS version used in /export/share is NFSv3, while the NFS version used in /export/home is NFSv4.

3. Using the rpcinfo Command

The rpcinfo command provides detailed information about the Remote Procedure Call (RPC) services running on a server, including the NFS version of each. Let’s check out the steps below to retrieve the NFS version:

$ rpcinfo -p | grep nfs
100003    3   tcp   2049  nfs
100003    4   tcp   2049  nfs
100003    3   udp   2049  nfs
100003    4   udp   2049  nfs

Firstly, let’s discuss the -p option used with the rpcinfo command. The -p option displays a list of all registered RPC programs and their corresponding versions and transport protocols. Here, we only show lines that contain the string nfs by | piping the output to the grep command.

Accordingly, the combination of rpcinfo -p and grep nfs provides a concise overview of the NFS RPC services and their versions and transport protocols available on the specified IP address. So, each line represents an RPC service related to NFS. Further, let’s break down the output by column number:

  1. 10003 is the RPC program number for NFS
  2. the numbers 3 and 4 indicate the version number of NFS, meaning that both NFSv3 and NFSv4 are supported
  3. the transport layer protocol can be User Datagram Protocol (udp) or Transmission Control Protocol (tcp)
  4. 2049 is the port number for NFS services
  5. nfs is the name of the NFS RPC service

The output shows that the NFS server at the specified IP address supports both NFSv3 and NFSv4, with both TCP and UDP transport protocols available.

4. Using the nfsstat Command

In addition to the previously mentioned methods, the nfsstat command provides useful information about NFS statistics, including the NFS protocol version.

The nfsstat command has several options:

  • -c: displays NFS client statistics
  • -s: shows NFS server statistics
  • -r: provides RPC (Remote Procedure Call) statistics
  • -p: displays NFS performance statistics

To get the NFS version, we’ll use either the -c or the -s options:

$ nfsstat -s
Server rpc:
Connection oriented:
calls     badcalls  nullrecv badlen    xdrcall  dupchecks dupreqs
15835      0          0          0          0          772        0

Version 3: (15835 calls)
null       getattr    setattr    lookup     access     readlink   read
7 0%       3033 19%   55 0%      1008 6%    1542 9%    20 0%      9000 56%

The above output shows a wide range of statistics related to the NFS server such as the number of calls and their types. However, it meets our goal of obtaining the NFS version indicated in the fifth line of the output. The Version 3 string means that the NFS version in this case is NFSv3.

Let’s check the output using the -c option:

$ nfsstat -c
Client nfs:
calls      badcalls   clgets     cltoomany
15835       0          0          0
Version 3: (15835 calls)
null       getattr    setattr    lookup     access     readlink   read
0 0%       0 0%       0 0%       0 0%       0 0%       0 0%       0 0%

In spite of the different statistics shown when using the -c flag, the command also shows the NFS version which is the same as the one in the output when using the -s option.

5. Using the /proc/mounts File

Another way to check the NFS version is by inspecting the /proc/mounts file, which contains information about the mounted filesystems on the system. In essence, the /proc/mounts file provides a representation of the currently mounted filesystems, resembling the format of the /etc/fstab file. Furthermore, it serves as a virtual file within the /proc pseudo-filesystem.

Thus, we can see the status of mounted objects as conveyed by the Linux kernel. Let’s get the NFS version via /proc/mounts:

$ cat /proc/mounts | grep nfs /mnt/nfs nfs nfsvers=3,rw,hard,rsize=8192,wsize=8192,timeo=14,intr 0 0

We used the cat command to copy the content of the /proc/mounts file into stdout. Basically, we pipe the output and then scan it for the word nfs by using the grep command. In particular, the output contains the NFS Server IP,, followed by the export path and the mounting path. To check the NFS version, we take a look at the nfsvers value in the output, which in this case is equal to 3. Hence, we find out that the NFS version used is NFSv3.

6. Conclusion

In a nutshell, determining the protocol version of an NFS server in Linux is a step to ensuring compatibility and performance optimization.

In this article, we explored four different methods to check the NFS version: using the showmount command, the rpcinfo command, or the nfsstat command, as well as inspecting the /proc/mounts file.

By using these methods, system administrators and users can ensure seamless connectivity and efficient file sharing with NFS servers.

Inline Feedbacks
View all comments