
Swap is a virtual memory that support to RAM (Random Access Memory). Swapping virtual memory is a technique used to improve the performance of a computer.
It allows the operating system to use one physical memory location for the storage of data that is currently being used by another process. This reduces the amount of time that the computer needs to access the physical memory to find the data that is needed.
If you don’t know how to add swap memory to your Linux machine. Check this article.
If you don’t want added swap space anymore, you can simply remove the swap space and reallocate to the disk storage.
First check do you have swap space, using this command to visualize it. (Current swap settings)
free -m
View the Swap mount location using this command
cat /proc/swaps
Stop Swap the swap partition. Note the partition location at the above command after that replace it. The red colored one is the swap location, replace it according to your VPS. This location is the root directory.
swapoff /swapfile
Next delete Swap partition files, using this command.
rm /swapfile
After the delete of swap files, remove startup startup items. Use this command to open startup file and edit it.
vi /etc/fstab
Follow the below example.
root@MinexVM ~ # free -m // View the current Swap settings (current system settings have 1162MB of virtual memory) total used free shared buff/cache available Mem: 981 270 240 6 470 564 Swap: 1162 29 1133 root@MinexVM ~ # cat /proc/swaps // View the Swap mount location (the current system is set to /swapfile in the root directory) Filename Type Size Used Priority /swapfile file 1190340 29952 -2 root@MinexVM ~ # swapoff /swapfile // Stop Swap the swap partition (note the partition location) root@MinexVM ~ # rm /swapfile // Delete Swap partition files root@MinexVM ~ # vi /etc/fstab // Remove startup startup items