Swap

Some useful links to explain the concepts of Swap

Concepts

Commands

  • Check total swap space used & sort it descending

1for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -nr | head -10
2for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | awk  '{print $1 " " $2/1024 " MB" }'|sort -k 2 -n -r | head -10
  • Alternatively - run below command

1sudo nice top (Press Shift+o  p (To sort processes by swap usage)

Configuration

Troubleshooting & Log Parsing

_images/swap-fallocate-centos7.png