Tuning the kernel through the proc filesystem in Debian

The behavior of the Linux kernel can be changed on the fly using the proc filesystem.

For basic information on changing kernel parameters through the /proc filesystem, read Documentation/sysctl/* in the Linux source.

Check  sysctl.conf manpage for how to set up the boot time kernel configuration through /proc filesystem with /etc/init.d/ script usually run from /etc/rcS.d/

 Too many open files

The Linux kernel may complain "Too many open files". This is due to the small default value (8096) for file-max. To fix this problem, run the following command as root:

# echo "65536" > /proc/sys/fs/file-max # for 2.2 and 2.4 kernel
# echo "131072" > /proc/sys/fs/inode-max # for 2.2 kernel only

or put the following into /etc/sysctl.conf for the permanent change:

file-max=65536 # for 2.2 and 2.4 kernel
inode-max=131072 # for 2.2 kernel only

 Disk flush intervals

You can change disk flush intervals through the proc filesystem. The following will shorten its interval from the default five seconds to one second.

# echo "40 0 0 0 100 30000 60 0 0" > /proc/sys/vm/bdflush

This may negatively impact file I/O performance a little bit. But this secures file contents except for the last one second which is shorter than the default five seconds. This is true even for journaling filesystems.

Sluggish old low memory machines

For some old low memory systems, it may still be useful to enable over-commit of memory through the proc filesystem:

# echo 1 > /proc/sys/vm/overcommit_memory

The 2.6 kernel with udev

The udev is a dynamic replacement for /dev/. Device names can be chosen to be very short ones. The devfs used in the 2.4 kernel is now obsolete.

Installing the new Debian 2.6 kernel provided by kernel-image-2.6.NN with udev package will enable this.