linux_wiki:use_proc_sys_and_sysctl_to_modify_and_set_kernel_runtime_parameters

This is an old revision of the document!


Use Proc Sys And Sysctl To Modify And Set Kernel Runtime Parameters

General Information

Modifying runtime or persistent kernel parameters.


Runtime Kernel Settings

Everything in this section are runtime ONLY changes; the values will go back to their original setting upon reboot.


View all tunable kernel parameters

sysctl -a


View the configuration of a specific setting

sysctl vm.swappiness


Write a runtime only configuration change and verify

sysctl -w vm.swappiness=10
sysctl vm.swappiness
  • -w → write


Alternative: Echo the value into the correct location in /proc

echo "15" > /proc/sys/vm/swappiness

Persistent Kernel Settings

To make changes that are persistent across reboots…

  • Default system values: /usr/lib/sysctl.d/
  • Persistent configuration over rides: /etc/sysctl.conf


Create entries in /etc/sysctl.conf

vim /etc/sysctl.conf
 
net.ipv4.ip_forward = 1


Load settings from a file

sysctl -p <filename>
  • If no file name is specified, defaults to: /etc/sysctl.conf


Note: Starting in CentOS 7.2, some parameters (such as vm.swappiness) are set AFTER systemd-sysctl.service by the tuned service.


View the active tuned profile

tuned-adm active


  • Location of built in system tuned profiles: /usr/lib/tuned/
  • Location of user defined profiles: /etc/tuned
  • Example: Create a virtual-guest override file
    mkdir /etc/tuned/virtual-guest
    cp /usr/lib/tuned/virtual-guest/tuned.conf /etc/tuned/virtual-guest/
    • Edit the over ride file (/etc/tuned/virtual-guest/tuned.conf), make any changes.
    • Restart the tuned service
      systemctl restart tuned

  • linux_wiki/use_proc_sys_and_sysctl_to_modify_and_set_kernel_runtime_parameters.1474231877.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)