Changing swappiness on Linux and SDD

The swappiness parameter is available from

  • "0" means "swap only to disk when you absolutely have to"
  • "100" means "swap immediately to disk"

If you are running you OS from an SDD, you might not want the default of 60, especially not if you have decent amounts of RAM (16 or 32 GB). In order to preserve the lifetime of your SDD drive, execute
sudo sysctl vm.swappiness=10.
However, the setting disappears after a reboot and in order to make it permanant, you need to add the following line to /etc/sysctl.conf: