Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I configure the swappiness value to another, from ex.: 60 to 0, then I always need to reboot the machine to the changes to take effect? Even when modifying with:

sysctl -w vm.swappiness=0
share|improve this question
up vote 13 down vote accepted

Everything is well explained in the Wikipedia page you gave.

# Set the swappiness value as root
echo 10 > /proc/sys/vm/swappiness

# Alternatively, run this as a non-root user
# This does the same as the previous command
sudo sysctl -w vm.swappiness=10

# Verify the change
cat /proc/sys/vm/swappiness

At this point, the system will manage the swap like you just configured it, BUT if you reboot NOW, your change will be forgotten and the system will work with the default value (assuming 60, meaning than it will start to swap at 40% occupation of RAM).

You have to add the line below in /etc/sysctl.conf to keep your change permanently:

vm.swappiness = 10

Hope it’s more clear for you now!

share|improve this answer

need to reboot the machine to the changes to take effect?

The opposite, in fact -- rebooting will reset the swappiness to its default value. To make it persist across reboots, you need to include a directive in a boot script or use the method recommended in the wikipedia article by adding:

vm.swappiness = ??

To /etc/sysctl.conf (or an /etc/sysctl.d file), where ?? is the value you want to use. Note that just adding this will not cause any change at the time.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.