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 use gzip in Linux?

Linux has many commands line tools to compress/decompress files and gzip is one of them. In this...

How to find all files/folders with 777 permission in Linux?

First of all, let us understand the meaning of 777 file permission in Linux. Suppose, any of the...

How to change SSH port on Ubuntu?

Please refer to the following steps to change the SSH port in Ubuntu. Login to your server via...

Will internal traffic between two VPS viz. a Database Server and a Web Server be counted in my bandwidth usage?

Yes it will. The traffic will be counted in the bandwidth usage of your VPS. Even if you use...

How to disable anonymous ftp in cpnael?

Note : It is not recommended to use anonymous FTP. It allows any person to access FTP without...

  • 0 Users Found This Useful

Was this answer helpful?