0

To try and fix an issue, I set swappiness to as low as possible, a 0, and swap is still being used. Why?

Running free -m gives:

total        used        free      shared  buff/cache   available
Mem:            484         241           8          58         235         134
Swap:          1023          97         926
3
  • 1
    Maybe because RAM is full? Or you had set it incorrectly? Add more detail like how exactly you configured it and the output of free -m
    – Byte Commander
    Oct 25 '17 at 12:54
  • You've got a pretty small amount of memory for Ubuntu in this machine - what version of Ubuntu are you running? Oct 25 '17 at 12:59
  • It's a VPS on Ubuntu 16.04(I can't afford a better server now) Oct 25 '17 at 12:59
4

Swappiness defines when swap is used.

For instance, swappiness of 40 defines to begin using swap when there is 40% of RAM left to use.

Swappiness of 0 defines swap is used when the RAM is full and 0% left to use.

To disable swap (totally not recommended as you could possibly end up with an unusable system), you run:

sudo swapoff -a

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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