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 install Dotnet Core on Centos 7 ?

Dotnet Core is now available with the Linux OS. Following are the steps to install Dotnet Core on...

How to install MongoDB version 4.0 on Centos 7?

MongoDB is an open-source and free Database service. It is a NoSQL Database and it is different...

How to take Backup of Exim Configuration from WHM?

EXIM comes with cPanel which is responsible for the email tranfer on the Linux server. Users can...

How to install ISPConfig on Debian 10?

ISPConfig is an Open-source Hosting Control Panel for Linux. It is used widely as it is free of...

How to change the timezone on Ubuntu 18.04 Server?

You can perform the below steps using root or sudo users. Check your current timezone by...

  • 0 Users Found This Useful

Was this answer helpful?