Wednesday, September 02, 2009

What is my NFS server doing?

If you're running an NFS daemon (nfsd), at some point in time you may have wondered what it was doing right now.  If it's running in kernel space, tools like lsof and strace don't work, so you're left guessing.

After much Googleing and some inspecting of the Kernel source code, I discovered some debugging values that can be poked into /proc/sys/sunrpc/nfsd_debug.  The most useful was 32, which I used like this:
echo 32 > /proc/sys/sunrpc/nfsd_debug; tail -f /var/log/messages | grep lookup

Essentially, this will give you an idea as to what files are being served up by nfsd.  Be careful, though: on a busy NFS server, this will spew lots of output to /var/log/messages.

After stopping the above command with CTRL+C, don't forget to turn off nfsd_debug:
echo 0 > /proc/sys/sunrpc/nfsd_debug

With this trick I was able to find some nasties that were hurting our NFS performance.

0 Comments:

Post a Comment

<< Home