Results 1 to 8 of 8

Thread: Increase size of swap partition

  1. #1
    Member Janak's Avatar
    Join Date
    Jul 2009
    Posts
    71

    Default Increase size of swap partition

    I was wondering if it is possible to increase the size of swap partition. If yes the how can I increase it?

    Thanks!

  2. #2
    Member Janak's Avatar
    Join Date
    Jul 2009
    Posts
    71

    Default

    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!

  3. #3
    cPanel Staff Eric's Avatar
    Join Date
    Nov 2007
    Location
    Texas
    Posts
    623
    cPanel/WHM Access Level

    Root Administrator

    Default

    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.

  4. #4
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Mar 2003
    Location
    NC
    Posts
    725
    cPanel/WHM Access Level

    Root Administrator

    Default

    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.

  5. #5
    Member
    Join Date
    May 2008
    Posts
    1,203

    Default

    To use a RAID Drive is also a better option to decrease number of Disk I/O.
    AccuWebHosting.Com | CPanel Hosting Provider Since 2003
    Cloud Powered Hosting | CPanel VPS
    Trusted by 20,000+ Clients Worldwide

  6. #6
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Mar 2003
    Location
    NC
    Posts
    725
    cPanel/WHM Access Level

    Root Administrator

    Default

    Quote Originally Posted by thewebhosting View Post
    To use a RAID Drive is also a better option to decrease number of Disk I/O.
    While true it is MUCH cheaper just to add in more RAM unless you are at the servers max -- even then upgrading may still be cheaper then RAID.

  7. #7
    Member
    Join Date
    Aug 2004
    Posts
    472

    Default

    It is always not recommended to increase the swap to high values.
    Cliffsupport.com
    iWebManager | Access WHM from your iPhone & Android

  8. #8
    Member Janak's Avatar
    Join Date
    Jul 2009
    Posts
    71

    Default

    Quote Originally Posted by eth00 View Post
    While true it is MUCH cheaper just to add in more RAM unless you are at the servers max -- even then upgrading may still be cheaper then RAID.
    Ok..I think I should upgrade RAM first and then think about SWAP if required.

Similar Threads

  1. Possible to increase partition size?
    By Andeveron in forum New User Questions
    Replies: 0
    Last Post: 11-21-2010, 09:08 AM
  2. Missing swap partition
    By JayAtjeu in forum cPanel & WHM Discussions
    Replies: 3
    Last Post: 07-11-2007, 10:48 AM
  3. Swap Size
    By bsasninja in forum cPanel & WHM Discussions
    Replies: 3
    Last Post: 03-20-2007, 04:45 PM
  4. how do I fix a corrupt swap partition?
    By chilihost in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 12-29-2005, 09:23 AM
  5. Linux OS - Swap partition placement
    By tseabaugh in forum cPanel & WHM Discussions
    Replies: 2
    Last Post: 05-07-2005, 04:02 AM

Tags for this Thread