Swap makes my system all sluggish and turning it off makes everything smoother. I have 3.5 GB of RAM.
I know how to turn swap off by entering
sudo swapoff -a in the terminal, but that's just for the current session, because after a reboot swap turns itself back on. Is there any way to turn swap off permanently?
May I suggest a safer approach? You never know when swap can save you from crashing. While swapping does indeed slow down your computer, if you use a program that eats up all your RAM, having the ability to swap can save you from a hard reboot. When the computer starts swapping, you'll notice and be able to kill the offending application.
So, instead of disabling swap altogether, just make sure your OS swaps very rarely. This is controlled by the
/etc/sysctl.conf. Ubuntu's default setting is
60if I remember correctly which is too much for most situations and will cause you to start swapping even while RAM is still available. If you reduce this value, you will be able to keep the safety line of swap while only using it for emergencies. So, open the file:
And add this line to it:
If that is still too much, change the 10 to 1. Now, after you restart, you will only swap when absolutely necessary and you can simply forget about it.