2014年3月2日 星期日

Clear Swap Space in Linux

There have been times where it has been necessary for me to clear out the swap space on a Linux system. In order to do this, you must first make sure that you have enough free memory to hold what is being used by swap.
I usually do this in a few steps. You do need to be root to do this. First I want to see what is currently being used.
free

Then I run the actual commands that empty the swap:
swapoff -a && swapon -a

Then I check what is being used after doing this.
free

I have these three steps in a script and then I just run the script, but, the commands could easily be run from the command line.

沒有留言:

張貼留言