How to disable active swap memory on the Linux system
The assigned swap memory can be disabled by using swapoff command. You can list all currently mounted and active swap partition by a following linux command:
# cat /proc/swaps
Filename Type Size Used Priority
/dev/sda6 partition 2047996 0 -1
/swap file 104857596 0 -2
From the above output we can see the type of swap used, relevant file and size. The size should match the swap size output of the free or top command:
# free | grep Swap
To disable all active swaps use -a option with swapoff:
# swapoff -a
The above will disable all active swaps found at /proc/swaps. It is also possible to disable each swap memory separately using swap file name. For example the below command will disable swap memory with a filename/swap:
# swapoff /swap
ARE YOU LOOKING FOR A LINUX JOB? Submit your RESUME, create a JOB ALERT or subscribe to RSS feed on LinuxCareers.com.
DO YOU NEED ADDITIONAL HELP? Get extra help by visiting our LINUX FORUM or simply use comments below.