How to remove Swap Space from Centos 7.x?

Please refer to the following steps to remove Swap space from Centos 7.x

  1. 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.

    swapon -s


  2. 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
  3. After that, you can check with the free command to verify that swap is disabled.

    free -m 


  4. Remove swap entry from /etc/fstab. To do this edit the file fstab and remove the swap entry.



  5. Let’s regenerate mount units to registers the new configuration:

    systemctl daemon-reload
  6. 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.

Related Articles

How to verify Linux System Is 32-bit or 64-bit?

You will find 64-bit OS in most modern computers. It is always recommended to have a 64-bit OS...

How to Stop and Disable ClamAV Service from CentOS?

We all know that ClamAV scanner is pretty heavy on CPU-Memory resources, and it should be avoided...

How to setup Database Map tool from WHM Panel?

cPanel provide a feature called Database Map tool. You can provide ownership of databases and...

How do I connect to Linux VPS through SSH from Linux and Windows OS?

This article will guide you on how to login to Linux VPS through SSH (Secure Shell) from Linux...

How to Switch Web Server from Apache to LiteSpeed on WHM?

Apache and LiteSpeed both are the WebServers. Apache is older and popular compared to LiteSpeed....

  • 0 Users Found This Useful

Was this answer helpful?