Increase size of swap partition

Janak

Well-Known Member
Jul 18, 2009
71
1
58
I found the solution. No need to reply this thread.

Open SSH and run below commands:

dd if=/dev/zero of=/usr/swap-file bs=1024 count=2048000
mkswap /usr/swap-file
swapon /usr/swap-file
swapon -s

Now add the following to the /etc/fstab and you are done.

/usr/swap-file swap swap defaults 0 0

I found this from Blogs | eth0.us - Server admin info for cPanel, plesk, ensim and linux!

Thanks!
 
  • Like
Reactions: Arash Mehmandoost

Eric

Well-Known Member
Nov 25, 2007
754
14
143
Texas
cPanel Access Level
Root Administrator
Twitter
That is one way to do it. Swap is really good at spreading the load across the system. So if you give swap 1 gig on 4 drives it'll equal out the load. It's a real neat feature, I donate a gig to swap on each hardware device in hopes of speeding things up over all.

Most of the time, if I'm swapping something is either really wrong, or it's time to get more ram. :D
 

eth00

Well-Known Member
PartnerNOC
Mar 30, 2003
721
1
168
NC
cPanel Access Level
Root Administrator
Also don't forget that swap is basically RAM but on the hard drive, so it is a lot slower. If you are starting to swap a lot your IOwait is probably going to very quickly increase which is going to bog down your server pretty quickly. You probably should look at optimizing or adding in some more RAM if you need more swap constantly.
 

thewebhosting

Well-Known Member
May 9, 2008
1,199
1
68
To use a RAID Drive is also a better option to decrease number of Disk I/O.