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)
View the Swap mount location using this command
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.
Next delete Swap partition files, using this command.
After the delete of swap files, remove startup startup items. Use this command to open startup file and edit it.
Follow the below example.
[email protected] ~ # 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 [email protected] ~ # 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 [email protected] ~ # swapoff /swapfile // Stop Swap the swap partition (note the partition location) [email protected] ~ # rm /swapfile // Delete Swap partition files [email protected] ~ # vi /etc/fstab // Remove startup startup items
Leave an answer