The swap space is a storage location in disk used by the system when the physical memory (RAM) is full. The system moves the inactive pages from the memory to the swap space and free up the RAM for the new demand. Swap is a storage in the secondary storage (disk).

Usually swap space is configured in all the Linux systems. But this is not recommended for in-memory processing systems. The main reason behind this is due to the chances of poor performance because of the usage of the swap.

To disable the already existing swap permanently in a linux machine, you can follow the following steps.

Step 1:

Disable the swap using the following command. The command takes sometime to free up and disable all the swaps.

swapoff -a 

The above command will disable the swap, but if the swap space is configured in the /etc/fstab file, the swap will get enabled on reboot of the server.

Step 2:

Remove the entries of swap storage from the /etc/fstab file if exists. This will permanently stop mounting the swap storage on restart of the server.

Open /etc/fstab file and check for the entries related to swap. Comment all those entries and save the file. Reboot the server