October 1999

Tunable Filesystem Parameters in /proc

We continue along at one of the more useful aspects of /proc which is tuning the system using echo for filesystem parameters.

The Main Directory for Filesystem Data

The tunable parameters for the filesystem are kept in /proc/sys/fs/. The remainder of the column will look at each file within that directory and for ones that can be tuned (or rather should be tuned).

The Regular Word of Warning

Do NOT go and "try these out" on a production system! If you truly wish to see these in action, please do use a test box of some sort.

The Deep Tour of /proc/sys/fs/


The status of the directory cache. It holds six values:

  • nr_dntry: always 0
  • nr_used: unused directory cache entries
  • age_limit: the number of seconds since the entry was made
  • reclaimed: this illustrates when memory is short
  • want_pages: internal to the kernel

dquot-nr and dquot-max

These files contain disk quota information, dquot-nr is the number of allocated disk quota entries and the number of free disk quota entries. The dquot-max file has information about the maximum number of cahced disk quota entries. If the number of free cached disk quotas is low and you have a lot of simultaneous users, raising it can improve performance.

file-nr and file-max

The value in file-max denotes the maximum number of file handles, while file-nr has a set of three values which denote:

  • the number of allocated file handles
  • the number of used file handles
  • the maximum number of file handles

If your system is sending you messages about running out of file handles, file-max is an obvious first place to look at changing.

NOTE: Document is based on 2.2.9-19 Mandrake. There is a "per process" file handle parameter which cannot be modified within /proc in this distro, it can be changed within the source, however.

inode-state, inode-nr and inode-max

The value in inode-max denotes the maximum number of inode handlers. It should be 3 to 4 times larger than file-max (to account for STDIN, STDERR, STDOUT and network socket file handles). If your system uses a lot of small files or you are getting messages about running out of inodes, increase the value.

While not related directly to tuning, inode-state and inode-nr are related to inodes-max in that inode-nr contains the first two entries of inode-state which contains two values and four dummy values, the two values are:

  • nr_inodes the number of inodes the system has allocated
  • nr_free_inodes the number of free inodes

If a filesystem problem on a system with a lot of command line users begins to bog, keeping an eye on these may help predicate and prevent a possible problem.

super-nr and super-max

The file super-max holds the maximum number of super block handlers and super-nr shows the current in use. Since every mounted filesystem needs a super block you may want to plan on having a lot of these if you are going to have a lot of mounted filesystems.

So When the Heck Would I Need to do This?

If you have a lot of small files, a sudden increase in users and files or a lot of mounted systems then now is the time to start looking into changing some of the filesystem parameters in /proc.

So how Do I Change a Parameter?

Simply echo STDOUT right into it like a regular file, say you wanted to raise file-max, here would be the syntax:

$ echo 4096 > file-max

A Look Ahead

For November, OutRider will move onto examining tunable parameters in /proc for memory or networking parameters or - if we're lucky - both.

For More Information

I gleaned most of the information directly out of this document on the /proc filesystem and tested it on a "beater-box" I own.