Ask Your Question

Swappiness setting

asked 2015-12-02 18:47:00 -0500

Geezus gravatar image

How do I permanently change the swapiness in Fedora 23.

edit retag flag offensive close merge delete


It's called "swappiness" (typo).

basic6 gravatar imagebasic6 ( 2017-09-17 08:16:02 -0500 )edit

To change the swappiness configuration:

Execute. cat /proc/sys/vm/swappiness. Execute. sudo sysctl vm.swappiness=0. TT Rock Stars To ensure that this setting persists through the server restarts: Use sudo or root user privileges to edit the kernel parameters configuration file /etc/sysctl.conf, so that the change is always in effect.

Abbey437 gravatar imageAbbey437 ( 2019-03-06 23:45:58 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2015-12-02 22:03:22 -0500

florian gravatar image

updated 2018-05-25 09:23:28 -0500

You can define swapiness in /etc/sysctl.d/99-sysctl.conf (sudo gedit /etc/sysctl.d/99-sysctl.conf) by adding:

vm.swappiness = x

for example:

vm.swappiness = 10

You should be able to check the swappiness afterwards by running sysctl vm.swappiness.

edit flag offensive delete link more


Just changing the config file does not set the swappiness. You'll have to reboot or set it manually, see my answer below. Also, I'd recommend creating a new file in sysctl.d because the default file (e.g., sysctl.conf) might be overwritten at some point.

basic6 gravatar imagebasic6 ( 2018-06-09 06:56:07 -0500 )edit

answered 2017-09-17 08:07:41 -0500

basic6 gravatar image

updated 2017-09-17 08:09:49 -0500

If you want to temporarily change the "swappiness" value, use the sysctl tool ("-w" means "write", this will change the value):

# sysctl -w vm.swappiness=10

Verify the value:

# sysctl vm.swappiness
vm.swappiness = 10

The value will be reset on reboot (usually to 60). If you want to change it permanently, put the desired value in a sysctl config file. It's recommended to use a separate file to not accidentally change or overwrite other sysctl settings (if you overwrite the global "sysctl.conf", you'll lose whatever was in there).

# echo 'vm.swappiness=1' >/etc/sysctl.d/swappiness.conf

Now, to apply the new value, tell sysctl to use it:

# sysctl -p /etc/sysctl.d/swappiness.conf

Verify it:

# sysctl vm.swappiness
vm.swappiness = 1

Naturally, these commands must be run as root. Use sudo or just su if sudo is not configured on your system.

edit flag offensive delete link more

Question Tools


Asked: 2015-12-02 18:47:00 -0500

Seen: 8,405 times

Last updated: May 25 '18