Today I have an issue where my swap is almost full. To check your swap usage:
$ free -m total used free shared buffers cached Mem: 1024 157 866 0 11 48 -/+ buffers/cache: 97 926 Swap: 127 95 32where -m is for the value to be listed in megabytes.
To clear the swap off, please use below commands (please run as root, or sudo):
# sync && /sbin/sysctl vm.drop_caches=3 && swapoff -a && swapon -a
where sync is to force changed blocks to disk and update the super block; sysctl vm.drop_caches=3 is to free pagecache, dentries and inodes; swapoff is to turn off swap and swapon is to turn swap back on, obviously :)
p.s. Thanks to linuxnetadmin and linuxinsight for the tips.
And you will get free swap after that:
$ free -m total used free shared buffers cached Mem: 1024 157 866 0 11 48 -/+ buffers/cache: 97 926 Swap: 127 0 127
That's all folks.
No comments:
Post a Comment