As time goes by, NFS mounts multiply like rabbits. Added by many different people over the years, these entries present a dizzying variety of mount options – most are a copy-paste job that makes little sense. All this variety inevitably results in performance issues that are difficult to pin down.

Before I could even begin to contemplate how to get things in order, I needed a clean and consistent listing of all the options for all the NFS mounts on all of the servers. I did not look forward to reading through hundreds of fstab files and decided to write a little script to collect all this data, standardize it, and output a spreadsheet.

The script (you can grab a copy from my GitHub repo) will go through all the NFS mounts in /proc/mounts and generate a list of the most commonly-used NFS mount options and a few other useful parameters. You will end up with a CSV file giving you a bird’s-eye view of the mounts and active options.

A few words about how the script works. It parses itself to get a list of the majority of  documented NFS mount options and their default values (all the lines beginning with #VAR). This data is used to build two arrays. The script then parses the contents of /proc/mounts to get the current values for each mount option, if it is explicitly set. If not – then it assumes the option is set to its default value. This process of working with multiple variables is described in more detail here.

The resulting CSV files can be merged into a single spreadsheet for easy searching and comparison. An optional step would be to load all this data into a database. This script is also available in my GitHub repo. It works with MySQL/MariaDB to create a table and populate it with the data from your CSV. Each time you run the script, it will drop the existing table and recreate it. You will need to edit the script to provide your database and login details.