How to enable NFS debug logging using rpcdebug

We can use the rpcdebug command to set and clear the Linux kernel’s NFS client and server debug flags. Setting these flags causes the kernel to log messages to the system log ( in response to NFS activity. Below is a list of modules which for which kernel debug flags can be set using rpcdebug command.

Module Function
nfs NFS client
nfsd NFS server
nlm Network Lock Manager Protocol(NLM)
rpc Remote Procedure Call

Viewing available rpcdebug modules

1. To view available rpcdebug modules, run:

# rpcdebug -vh
usage: rpcdebug [-v] [-h] [-m module] [-s flags...|-c flags...]
       set or cancel debug flags.

Module     Valid flags
rpc        xprt call debug nfs auth bind sched trans svcsock svcdsp misc cache all
nfs        vfs dircache lookupcache pagecache proc xdr file root callback client mount fscache pnfs pnfs_ld state all
nfsd       sock fh export svc proc fileop auth repcache xdr lockd all
nlm        svc client clntlock svclock monitor clntsubs svcsubs hostcache xdr all

Here,

-m : module name to set or clear kernel debug flags
-s : To set available kernel debug flag for a module
-c : Clear Kernel debug flags

Enable debugging – Examples

1. Enable all NFS (client-side) debugging
To enable NFS debugging on the client :

# rpcdebug -m nfs -s all

2. Enable NFSD (server-side) lockd debugging
To enable server side nfsd lockd debugging:

# rpcdebug -m nfsd -s lockd

3. Enable RPC Call debugging
To enable RPC call debugging :

# rpcdebug -m rpc -s call

Disable debugging

To disable debugging, use the -c (clear) option, for example:

# rpcdebug -m nfs -c all
# rpcdebug -m nfsd -c all
Note : Make sure to disable debugging when finished debugging. When enabled, debugging creates a tremendous amount of output on the logs, potentially impacting system performance.
Related Post