How to add and increase swap on CentOS

Adding a swap file without reboot

If you are having a dedicated server somewhere with not that much memory, you could decide to add a swap without rebooting your server.

To do so, you need to follow the routine:

Increasing a swap size

If something goes wrong with your system, and you see that your swap file is full

Then you would want to increase it. But most of the time you cannot just remove a swap file and add a bigger one.
What you can do is adding a new temporary file without removing an existing one, the remove the original one, add it again with increased size, and finally remove the temporary file. Like this:

Similar Posts

LEAVE A COMMENT