I have noticed my system is not using any swap.
- system got unresponsive when RAM got full
swapon --show
returns nil/etc/fstab
has nothing about swap in it
I am utterly confused by the myriad of different ways to enable swap which I read about. Do I really need to define a swap file, rather than only point the system at a swap partition?
I have a partition of the right size formatted as linux-swap
. What is the series of steps to be taken for (perpetually) enabling it in my OS?
Ubuntu 16.04
Well, I obtained the UUID of my idle
linux-swap
formatted partition from gparted, then:/etc/fstab
to include the line:UUID=999990-999-999-9999-999 none swap sw 0 0
Of course you'll need to replace the 9's with your carefully determined UUID of your intended swap partition.sudo swapon --all --verbose
I think you really want to use the UUID even though you could go by partition name and stuff, because the names can easily change such as maybe when you add or reposition drives inside your machine.
The last command seems to correctly detect my swap partition, and htop now shows the size of the partition, hurray!
You may also want to get to know your swappiness value, which you can easily do following the swappiness section in these docs, while at it, even though you'd typically not find any surprises there nor have real reason to change it.
Even though this seems working, please do not follow these steps before few upvotes from other people have shown up aside my answer, I've only performed this once thus far.