Checking Swap Space Size and Usage on CentOS
You can check the size and current usage of CentOS swap space by running:
$ grep SwapTotal /proc/meminfo
You can check current swap activity using:
$ vmstat 3 100
procs --------memory---------- --swap-- --io-- --system-- --cpu---
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 1272 61748 227044 2786452 0 0 1 3 7 7 0 0 100 0 0
0 0 1272 61764 227044 2786452 0 0 0 19 18 19 0 0 100 0 0
0 0 1272 61796 227044 2786452 0 0 0 0 21 25 0 0 100 0 0
0 0 1272 61796 227044 2786452 0 0 0 12 29 29 0 0 100 0 0
The swpd column shows total swap usage. The si and so columns show the amount of memory swapped in and swapped out. Swapping should be relatively rare, so the si and so columns should usually be zero. If they are consistently non-zero, your system needs more RAM.