I have installed and run Netdata on my Debian based home server and I wanted to enable KSM after Netdata installer suggested it could save some RAM.
To enable the KSM on boot in Debian you I executed these steps:
- Install
ksmtuned
without all the QEMU dependencies:
sudo apt-get install ksmtuned --no-install-recommends
- I actually don't need the
ksmtuned.service
and I did disabled it:
sudo systemctl stop ksmtuned.service
sudo systemctl disable ksmtuned.service
- Finally if:
sudo cat /sys/kernel/mm/ksm/run
returns 0
restart the ksm.service
:
sudo systemctl restart ksm.service
Thanks. I don't have that service for some reason, despite following your steps and everything appeared to proceed without an issue (though I am running Arch, not Debian). I found that not having the ksm service is not a problem. In case anyone else runs into this and wants a different solution: you can use systemd's temporary files system to enable ksm at boot time (you will need to reboot or
echo 1 > /sys/kernel/mm/ksm/run
to enable it, though).Create
/etc/tmpfiles.d/ksm.conf
with the contents:Also, you can verify KSM is working by checking
/sys/kernel/mm/ksm/pages_shared
. If the output of that is a non-zero number, you are good to go.