Wednesday, February 3, 2016

Debugging Network File System (NFS) connections

Introduction


There are a number of useful shell command line utilities that can be used to debug Network File System (NFS) connections.  These utilities are typically available on most Linux or other Unix-variant operating system.

rpcinfo

This utility can be used by client computers to find out what services and protocols are supported by a given server.  This is a good starting point to find out if the NFS services are enabled on a given computer.  There are three services typically needed for NFSv3 connections: portmapper, mount and nfs.  The man pages (man rpcinfo) will provide more information about the various options available.

showmount

This utility can be used to list what directories have been exported by a given NFS server.  See the man page for the command line options on your system.

Network Protocol Analyzers

There are a number of free utilities which can be used to analyze network transactions: Wireshark, tcpdump. and others.  These utilities allow the user to monitor network traffic between the client and the server and log it.  The analyzers can then be used to review the log to see what individual commands were sent from the client and the response from the server.

Centos

On Centos, it is possible to enable logging using rpcdebug:

rpcdebug -m nfsd -s all

will send logging for the nfs server to /var/log/messages

and 

rpcdebug -m nfsd -c all

will disable logging again.  See "man rpcdebug" for more info.

If trying to debug a command like df:

strace df -h

will print out system calls made executing the command.  To output to a file:

strace df -h 2> traceout.txt