Linux – How to monitor which files are accessed through NFS

linuxmonitoringnfsnfs4

I have a linux file server running CentOS 6. Files are accessed via NFS4.

Sometimes I have problems with disk io load. I want to find out what is causing them.

I can find out which client is causing them with tcpdump and nfsiostat (on the clients). But I want to know either which files are accessed or which process is doing the accesses. Then I can think about a solution for it.

I have tried to use wireshark to decode the accesses, but it is hard to read when open and read/write are not close together or you have lots of files with similar names (directories are not shown, just dir handles). If you have a lot of activity it would be nice to have a way to sort files by activity to find out what is the culprit.

Does anybody know of a solution for this?

Best Answer

You can use either lsof or ftop (the last one is on EPEL repo)

For example:

lsof -N /mnt/nfs/*

HTH

Related Topic