Linux – Move swap contents back to the RAM once there’s free memory

linuxswap

So I understand that swap mem is used when computer runs out of space on ram.

Once there is available space in the memory how can I move contents of swap to ram so taht it doesn't slow me down?

Best Answer

If you really have enough RAM to not need swap, then issue:

/sbin/swapoff -a

This will remove all swap from the system, move any useful data to RAM and then prevent the system from using it.

This, of course, comes with consequences but that will become evident if you don't have enough RAM.

Related Question