Please refer to the following steps to remove Swap space from Centos 7.x
- At first, check if your system is running with the swap space or not with the below command. It will list the swap space with its location.
- As per the above location, swap space is located at /dev/vdb location since it is a virtual server. Now, we will disable the swap space by executing the below command.
swapoff -v /dev/vdb
- After that, you can check with the free command to verify that swap is disabled.
- Remove swap entry from /etc/fstab. To do this edit the file fstab and remove the swap entry.
- Let’s regenerate mount units to registers the new configuration:
- Finally, remove the actual swap file.
rm -rf /dev/vdb
This is it. We have successfully removed the swap space.
Looking to add a new swap space. Please refer to Accuweb > Add Swap Space article for more details.