Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have some sensitive data in ram that i prefer not to be on disk. How do i disable swap? I have more then enough ram. If ram 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)

share|improve this question
add comment

1 Answer

up vote 22 down vote accepted

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.

share|improve this answer
This doesn't seem to persist across a reboot? –  ebyrob Apr 20 '13 at 2:31
Permanent changes to swap are usually made in /etc/fstab. –  ubfan1 Apr 20 '13 at 5:51
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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