Empty swapfile back into RAM
You just have to turn swapping off, wait for the memory to be re-assigned and then turn it back on again.
$ sudo swapoff -a
Wait...
$ sudo swapon -a
That's it!
See this thread for more: https://askubuntu.com/questions/1357/how-to-empty-swap-if-there-is-free-ram
Item 401 is the main one.
Also check out the next item (140), for information on how to set your swappiness so that your system uses swap less aggressively.
To check the swappiness:
$ cat /proc/sys/vm/swappiness
To set it to 10 (recommended value) from 60 (default factory setting) temporarily:
$ sudo sysctl vm.swappiness=10
To change it permanently (after a restart):
sudoedit /etc/sysctl.conf
And add this line
vm.swappiness = 10
Swappiness runs from 0-100, where zero is swapoff and 100 aggressively transfers data from RAM to swap.
Document Actions




{Built on Planet Plone}