How To Clear Swap Memory In Linux / CentOS / RHEL ?

How To Clear Swap Memory In Linux / CentOS / RHEL ?

Swap space is used when the physical memory (RAM) is full. When the physical is overflow then the inactive pages which are available in the physical memory will be moved to swap space. Swap is a small portion which is attached on hard drive to increase the performance of the system. swap portion we can keep rarely needed items away from the RAM memory. Swap memory is not quick as RAM but when RAM overflows then pages moved to swap memory.

Swap memory always should be 2X physical RAM. When swap memory full then the inactive pages moved from physical memory to swap memory, but if they moved pages don’t get back to physical memory in normal condition then you have to manually clear the swap memory so that the pages moved back to physical memory. For that you have to follow the below steps:

Note : Before using the command, it is must to have enough space in physical memory. To clear your 2GB swap memory, it is must to have more than 2GB physical memory.

Code:
Swapoff –a
After running the above command, now you have to start the swap memory with this command :

Code:
swapon –a
Author
bhawanisingh
Views
3,629
First release
Last update
Rating
0.00 star(s) 0 ratings
Top