Sysctls

From Freenas
Jump to: navigation, search

sysctl(8) is an interface that is used to make changes to the FreeBSD kernel running on a FreeNAS® system. It can be used to tune the system in order to meet the specific needs of a network. Over five hundred system variables can be set using sysctl(8). Each variable is known as a MIB as it is comprised of a dotted set of components. Since these MIBs are specific to the kernel feature that is being tuned, descriptions can be found in many FreeBSD man pages (e.g. sysctl(3), tcp(4) and tuning(7)) and in many sections of the FreeBSD Handbook.

DANGER! changing the value of a sysctl MIB is an advanced feature that immediately affects the running kernel of the FreeNAS® system. Do not change a MIB on a production system unless you understand the ramifications of that change. A badly configured MIB could cause the system to become unbootable, unreachable via the network, or can cause the system to panic under load. Certain changes may break assumptions made by the FreeNAS® software. This means that you should always test the impact of any changes on a test system first.

FreeNAS® provides a graphical interface for managing sysctl MIBs. To add a sysctl, go to System → Sysctls → Add Sysctl, shown in Figure 4.7a.

Figure 4.7a: Adding a Sysctl

Sysctl.png

Table 4.7a summarizes the options when adding a sysctl.

Table 4.7a: Adding a Sysctl

Setting Value Description
Variable string must be in dotted format e.g. kern.ipc.shmmax
Value integer or string value to associate with the MIB; do not make this up, refer to the suggested values in a man page, FreeBSD Handbook page, or tutorial
Comment string optional, but a useful reminder for the reason behind using this MIB/value
Enabled checkbox uncheck if you would like to disable the sysctl without deleting it

As soon as you add or edit a sysctl, the running kernel will change that variable to the value you specify. As long as the sysctl exists, that value will persist across reboots and upgrades.

Note that any sysctl that is "read only" will require a reboot to enable the setting change. You can verify if a sysctl is read only by attempting to change it from Shell. For example, to change the value of net.inet.tcp.delay_ack to 1, use the command sysctl net.inet.tcp.delay_ack=1. If the sysctl value is read only, an error message will indicate that the setting is read only. If you do not get an error, the setting is now applied. However, for the setting to be persistent across reboots, the sysctl must be added in System → Sysctls.

Any MIBs that you add will be listed in System → Sysctls → View Sysctls. To change the value of a MIB, click its Edit button. To remove a MIB, click its Delete button.

At this time, the GUI does not display the sysctl MIBs that are pre-set in the installation image. FreeNAS® 9.2.0 ships with the following MIBs set:

kern.metadelay=3
kern.dirdelay=4
kern.filedelay=5
kern.coredump=0
net.inet.tcp.delayed_ack=0  

Do not add or edit the default MIBS as sysctls as doing so will overwrite the default values which may render the system unusable.

Personal tools
Navigation