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.

How useful was this post?

Click on a star to rate it!

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?


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. Looking for better web hosting? Sign up today and take 50% off your first month with promo code: 1stmonth50

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.