mountstats Command Examples in Linux

The mountstats command displays various NFS client statistics for each given mount point. If no mount point is given, statistics will be displayed for all NFS mount points on the client. This command is useful in obtaining NFS mount options, buffered versus direct IO, RTT latency per RPC procedure, and backlog latency per RPC procedure.

mountstats Command Examples

1. To get the NFS mount stats:

# mountstats 

2. To get only NFS mount stats:

# mountstats --nfs 

3. To display the RPC stats:

# mountstats --rpc 

4. To display only the transport statistics:

# mountstats --xprt 

5. Display only the raw statistics. This is intended for use with the -f|–file and -S|–since options.

# mountstats --raw --file [file]
# mountstats --raw --since [time]

6. To display the version info:

# mountstats --version 

Conclusion

The mountstats command queries the file /proc/self/mountstats to display the NFS client statistics. You can also use this file directly to determine the date an NFS share was mounted. Use the below script/command to determine the date an NFS share was mounted.

# date -d "@$(($(date +%s)-$(grep -A 2 "/mnt " /proc/self/mountstats | awk -F: '/age/ { print $2 }')))"

“/mnt ” should be replaced with the actual mount point

Related Post