13

I'm mounting a NFS filesystem on my machine. How do I figure out what version of the NFS protocol the server uses? I don't have access to the NFS server machine, but I do have root on my client machine.

Is there anything I can run on my client machine to identify what version of the NFS protocol is being used by the server, or what versions it supports?

I wasn't able to find any useful information in /var/log/messages or kernel debugging output (dmesg).

I have tried running nfsstat, but I'm not sure if it is giving me any useful information. However, when I run nfsstat -s to request information about the server, I don't see anything useful:

# nfsstat -s
Server rpc stats:
calls      badcalls   badfmt     badauth    badclnt
0          0          0          0          0       

When I run nfsstat -c to request information about the client, I do see some information about Client nfs v3, but I'm not sure how to interpret this. Does this tell me anything about the protocol being used between my client machine and the NFS server? Does it mean I am currently using v3 of the NFS protocol? Does it tell me anything about what versions of the NFS protocol the server supports, e.g., NFS v4?

19

The nfsstat -c program will show you the NFS version actually being used.

If you run rpcinfo -p {server} you will see all the versions of all the RPC programs that the server supports. On my system I get this output:

$ rpcinfo -p localhost
   program vers proto   port
    100000    2   tcp    111  portmapper
    100000    2   udp    111  portmapper
    ...
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    ...

This shows me that my NFS server (localhost in this example) offers versions 2, 3, and 4 of the NFS protocol all over UDP and TCP.

  • How can you tell if V4 is 4.2 or something else (preferably without having the nfs actually running .. as I cannot mount from the client for some reason)? – Dylan Dec 17 '15 at 17:08
  • @Dylan why not ask that as a new question? – roaima Dec 17 '15 at 17:33
4

Depending your OS and version there may be different ways to check it.

nfsstat:

# nfsstat -m
/mnt/share from 10.0.0.1:/mnt/share
Flags:  rw,relatime,vers=3,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.0.0.1,mountvers=3,mountport=30924,mountproto=udp,local_lock=none,addr=10.0.0.1

But you can for sure

# grep nfs /proc/mounts
10.0.0.1:/mnt/share /mnt/share nfs rw,relatime,vers=3,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.0.0.1,mountvers=3,mountport=30924,mountproto=udp,local_lock=none,addr=10.0.0.1

which is obviously the same output.

It shows vers=3 on server, and mountvers=3.

  • 1
    grep nfs /proc/mounts (for me on the server) only displays nfsd /proc/nfsd nfsd rw,realtime 0 0. I don't have the client actually mounted (I can't get it to work). Everything seems fine (using nfs4 on both, IP addresses are correct, /etc/exports is fine, nfs-server has been restarted, exportfs -rav looks fine, showmount -e server from client looks fine, etc. .. but when I try to mount EVERY TIME .. it hangs until mount.nfs: Connection timed out --or-- mount.nfs4: Connection timed out. So frustrating. Sorry for my rant that will probably go unfixed). – Dylan Dec 17 '15 at 17:15
  • so, I guess .. is there a way to get the nfs version (like 4.2 or 4.1 or what have you) without having the client mounted? – Dylan Dec 17 '15 at 17:17
  • I have been working hard on the same issue. All is fine and it used to work. I recreated my Vagrant VM's and then it stopped working. Nfsstat shows that all calls are badcalls of typ badauth. – onknows Jul 25 at 7:15
-2

One can open /etc/nfsmount.conf and get the information about default version and supported version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.