sysctl and sysfs

Jump to: navigation, search

sysctl vs. sysfs

Don't confuse these two. The sysctl interface is for stuff under /proc/sys, whereas sysfs is for stuff under /sys (or anywhere a sysfs filesystem is mounted).

Under Ubuntu/Debian you may need to install the procps package to support sysctl and for processing /etc/sysctl.conf at boot. You may also need to install the sysfsutils package to support sys tool and for processing /etc/sysfs.conf at boot.

sysfs settings -- "/etc/sysfs.conf" and "/etc/sysfs.d/"

The systool' command is not often useful. It provides no way to modify attributes and most of the same information can be found under /sys/. The systool command can be used like this:

systool -c block sda -v

sysctl settings -- "/etc/sysctl.conf" and "/etc/sysctl.d/"

Sysctl will accept either . or / in key names. Most commonly you see . used in config files. Be sure to trim off the leading /proc/sys/ before using it with sysctl. For example, the last two commands below are equivalent.

cat /proc/sys/vm/swappiness
sysctl vm.swappiness
sysctl -w vm.swappiness=10
sysctl -w vm/swappiness=10

These settings are usually found in a conf file, /etc/sysctl.conf or in a script under the directory, /etc/sysctl.d/, such as /etc/sysctl.d/60-local.conf.