swappiness is set to 0 and I can't change it.
I have tried changing the swappiness setting in /etc/sysctl.conf
and /etc/sysfs.conf
– both are ignored after reboot (Ubuntu 12.04):
$ sudo gedit /etc/sysctl.conf
vm.swappiness=60
$ sudo gedit /etc/sysfs.conf
vm.swappiness=60
/etc/sysctl.d/60-my-swappiness.conf
vm.swappiness=60
$ sudo cat /proc/sys/vm/swappiness
0
$ rgrep swappiness /etc/sysctl.*
/etc/sysctl.conf:# swappiness
/etc/sysctl.conf:vm.swappiness=60
/etc/sysctl.conf~:# swappiness
/etc/sysctl.conf~:vm.swappiness = 60
/etc/sysctl.d/60-my-swappiness.conf:vm.swappiness = 60
$ sudo sysctl -p
vm.swappiness = 60
$ sudo cat /proc/sys/vm/swappiness
60
After reboot, swappiness is again set to zero:
$ sudo cat /proc/sys/vm/swappiness
0
Why are my settings in /etc/sysctl.conf
are not loading after reboot?
Is there something wrong with procps?
What should I check?
I looked for answer in askubuntu and on other sites, but I have not found the answer.
I saw this, but there is no answer:
Swappiness setting ignored in systcl.conf
How can I resolve this issue?
Best Answer
please verify first by using the following:
This output gives you the right swappiness at the moment. (it could be 0 it could be 60)
If you want to change this do the following:
I use leafpad as an editor but you can change this with gedit (what has a bug in it) scroll at the bottom of this file and add # altering swappiness
vm.swappiness= (give here the digit you want e.g. 60 or 10 (bold is for pointing out)
save this altered file and reboot completely
verify your swappiness again by using the command I gave above (cat ....)
I use for 1Gb RAM or more the value 10; for less than 1Gb RAM the value 5 (personal experience) . Only for a server or something like that the value 60 is required.
Good luck !