Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I get alert emails whenever swap usage is at 100%. In my case, swap usage doesn't reduce later on (even though memory is free) so I get an alert email every hour.

How can I reduce swap usage without rebooting my Linux server?

share|improve this question
1  
If your swap is regularly filling up, then you need to increase the amount of RAM in your server. –  EEAA Jan 27 '12 at 14:30
    
I'd rather know what process is using the swap rather than throwing more ram at it, e.g. run top(press Op). –  Mark Jan 27 '12 at 18:15
    
What is your swappiness set to? cat /proc/sys/vm/swappiness A high swappiness and small swap file means it will be full often. Reduce swappiness or increase the size of the swap file, or both. –  Brian Sep 17 at 19:27

1 Answer 1

You can run swapoff -a as root to swap all memory back in. Don't forget to run swapon -a afterwards to make swap available again. Note that swapoff will fail if there is not enough physical memory available to swap everything back in.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.