my swap is not being used, no matter how full my RAM gets. This is my swapon output:

/dev/dm-2 partition 31,9G 3,5M   -1

Could the PRIO -1 be a problem?

cat /proc/sys/vm/swappiness

My swappiness is 60.

cat /proc/swaps
Filename             Type       Size        Used    Priority
/dev/dm-2            partition  33456124    3524    -1

I have 32GB of RAM and 32GB of swap, but currently when my memory runs my system will just lock up permanently rather than start swapping. Anything I can do about that?

Basically I am trying to run an application that will eat about 30GB of memory, while me physical memory is already half full. While it is booting up and loading data into memory my system just freezes, once the physical memory is full. And no it doesn't appear to just lock up while it is swapping, since even after a while doesn't unfreeze.

3 Answers 3


Increasing swappiness fixed it. The swap was enabled, but for some reason only used when the memory was completely full, and no sooner.

  • 1
    Is a value of 60 for swappiness an indication for not using swap before memory is completely full? is that a good default?
    – matanster
    Jan 24, 2018 at 14:05
  • 1
    What did you find to be a good value for "swappiness"?
    – user929404
    Sep 27, 2018 at 12:36
  • 4
    60 is the default. If that doesn't swap enough, increase the value in 5-10 increments and retest. If you have lots of memory and want to use it all before swapping try a very low value. 0 means the system will never swap, 1 means that it will only swap in order to avoid a crash. But based on my original question, sometimes it may make sense to use a higher value if your memory fills up very rapidly and you experience lockups. Sep 27, 2018 at 14:00
  • Swappiness = 1 worked for me, while values as high as 80 and 100 didn't serve the purpose.
    – Yankee
    Mar 22, 2019 at 9:09
  • 1
    – Tod
    Aug 15, 2020 at 16:32

In my case I installed another Ubuntu test instance and formatted the swap for it, so the UUID of the swap device was old in fstab, I just changed it to current and it works.


Don't think so. First check cat /etc/fstab for your swap partition, then try formatting the swap file system with

sudo swapoff -a
sudo /sbin/mkswap /dev/sd##
sudo swapon -a

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .