2.2. Setting persistent tuning parameters

2.2. Setting persistent tuning parameters

This book contains many examples on how to specify kernel tuning parameters. Unless stated otherwise, the instructions will cause the parameters to remain in effect until the system reboots or they are explicitly changed. This approach is effective for establishing the initial tuning configuration.

Once you have decided what tuning configuration works for your system, you will probably want those parameters to be persistent across reboots. Which method you choose depends on the type of parameter you are setting.

Editing the /etc/sysctl.conf file

For any parameter that begins with /proc/sys/, including it in the /etc/sysctl.conf file will make the parameter persistent.

  1. Open the /etc/sysctl.conf file in your chosen text editor

  2. Remove the /proc/sys/ prefix from the command and replace the central “/” with a “.

    For example: the command echo 2 > /proc/sys/kernel/vsyscall64 will become kernel.vsyscall64.

  3. Insert the new entry into the /etc/sysctl.conf file with the required parameter

    # Enable gettimeofday(2)
    kernel.vsyscall64 = 2
    
  4. Run # sysctl -p to refresh with the new configuration

    # sysctl -p
    ...[output truncated]...
    kernel.vsyscall64 = 2
    

Editing files in the /etc/sysconfig/ directory

Files in the /etc/sysconfig/ directory can be added for most other parameters. As files in this directory can differ significantly, instructions for these will be explicitly stated where appropriate.

Alternatively, check the Red Hat Enterprise Linux Deployment Guide available from the Red Hat Documentation website for information on the /etc/sysconfig/ directory.

Editing the /etc/rc.d/rc.local file

Use this option only as a last resort!

  1. Adjust the command as per the Editing the /etc/sysctl.conf file intructions.

  2. Insert the new entry into the /etc/rc.d/rc.local file with the required parameter