Knowledgebase Home / Increase swap file size on cPanel WHM

Increase swap file size on cPanel WHM

Generally, you would want to have a dedicated partition for swap however, a swap file can also be used. You can follow the steps below to create/increase your swap file on a cPanel server. Please note, you must have root access to perform this action. If you’re unsure if you need to do this, please either consult our support department (if you’re a VeeroTech customer) or your server administrator before performing these steps.

Creating the swap file via ssh:

touch /swapfile

Create a 2GB swap file using the command below:

dd if=/dev/zero of=/swapfile bs=1M count=2048

Make the swap

mkswap /swapfile

Activate the swap file:

swapon /swapfile

Add an entry to the fstab to mount the swap file on boot:

nano /etc/fstab

Once inside of the editor for the fstab, enter the line below at the end of the file:

/swapfile swap swap defaults 0 0

Now, save/close the fstab file & reboot your server. Once rebooted, you should now see the new swap size.


If the steps above listed in this article do not resolve your issue, please feel free to open a support ticket and we’d be happy to take a look.  

Ready for NVMe Hosting? And you thought SSD was fast...Get started today for $1.00 Promo code: 1dollar

Our Guiding Principles

  • Provide consistent, stable and reliable web hosting services.
  • Ensure rapid ticket response and quick resolutions to issues.
  • Never saturate or over-provision servers to ensure stability and speed for our customers.
  • Use only high quality enterprise-class hardware to ensure minimal downtime from hardware failures.
  • Provide clear pricing with no hidden fees or gotchas.