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

Updating MariaDB to v10.2.35 or v10.3.26 is showing MySQL Databases as offline in cPanel.

You might see your cPanel is showing The MySQL server is currently offline after updating MariaDB...

Is it possible to take complete VPS backup in VPS itself?

Please note that, there is no provision to take backup of full VPS image in VPS itself. As an...

How to setup VSFTPD on CentOS 7.x?

VSFTPD is an FTP server for Unix/Linux systems. It is a default FTP server on CentOS, RHEL Linux...

What is IP forwarding in Linux? How to enable IP forwarding?

IP forwarding helps you to set up the OS to work as a router. You can set IP forwarding when you...

How you can change the ip address of the domain in Webmin control panel?

Following are the steps to change the IP Address of the domain in Webmin control panel. Login...

  • 0 Users Found This Useful

Was this answer helpful?