Ubuntu – How to disable swap

swap

I have some sensitive data in RAM that I prefer not to be on disk. How do I disable swap?

I have more than enough RAM. If RAM consumption gets too high I have no problems with processes being terminated. How do I disable swap?

Note: I do not have a swap partition and this is running in a VM (VMware)

Best Answer

Using

sudo swapoff -a  

is the usual way to turn off swap, with the swapon -a command used to turn it back on. See man swapoff for more information about turning off swap for explicit devices.

Related Question