Question
How can I increase or decrease the swap on my server?
Answer
The swap size can be changed without rebooting the server using the create-swap script.
- Turn off the swap space.
swapoff -a
- Edit /etc/fstab and comment out the swap line.
#/usr/swpDSK swap swap defaults 0
Please note that multiple swap sources can exist. This step is only required if you're replacing the swap file generated by the create-swap script. - Run the create-swap script to resize the swap file. Please replace # with the size in Gigabytes that the new swap file should be.
/usr/local/cpanel/bin/create-swap --size #G -v
To verify that the swap was resized correctly, use the free command.