Sunday, January 18, 2015

A few words about swap in linux

Just because swap is allocated, doesn't mean it's being 'used'. Whilst programs like system monitor and top will show some of your swap space being allocated that doesn't mean that the system is actively swapping in/out.
To find out if anything is swapping in/out you can use the vmstat command. Leave it running a few seconds to settle down and watch the si (swapin) and so (swapout) columns. If nothing is happening then there is no reason to be concerned.

Use the command vmstat 1 and watch the output.

Some people suggest that in order to clean the swap used on the machine you can do a swapoff -a && swapon -a. That will do the trick, but i am not sure what will happen if the system needs the swap while it is off. It possible that just rebooting is a better option.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.