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 you have any web hosting questions please feel free to reach out to us. We're happy to help.
Shared Hosting | Reseller Hosting | Managed WordPress Hosting | Fully Managed VPS Hosting
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.