Resize SwapSize Centos6.7

General support questions
Post Reply
darkfurby
Posts: 7
Joined: 2017/03/01 10:24:11

Resize SwapSize Centos6.7

Post by darkfurby » 2017/04/13 14:03:52

Hello,

I couldnt find any topic about resizing SwapSize. I have installed Centos 6.7 on my server, with 32GB disk, for now. Later I will add additional disk but it doesnt matter at the moment. The thing is that, I checked the swap Size and it is 3,5GB, while physical RAM has 7GB. When I installed Centos 5 previously, system attached 9GB of swapSize. Why Centos 6 provided only 3,5GB? In the future i will installl oracle database and as docs says, SwapSize must be atleast the same size as physical ram.

Please assist, how can I change it? Guides on internet are not clear to me :(.

Thank you in advance for your prompt respond.

Best Regards,
Anon

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Resize SwapSize Centos6.7

Post by TrevorH » 2017/04/13 15:01:11

The swap sizing calculations on the net are pretty much all out of date and don't cater for machines with large amounts of RAM. If you allocate and use more than a couple of GB then your system performance will almost certainly hit the toilet. However, I believe that Oracle in their infinite wisdom have hard coded a check in their installer to make you allocate the same amount (or even double) the RAM you have installed. If that is the case then you may need to amend it to let the installer complete (doesn't mean you can't change it back afterwards!).

If your system is using LVM and your swap space is on an LV then you can remove it on the fly assuming that the system is currently not busy and you have more RAM free than the amount of swap that's actually used. To do this, first check using swapon -s how much is used and how much RAM you have free (with free -m). If you have sufficient then you can swapoff -a then lvremove the current swap LV, use lvcreate to allocate a new one of the required size (assuming you have sufficient disk space available in your VG) and same name, run mkswap against it, then swapon -a to activate it. Worth checking that /etc/fstab uses the swap by name and not by UUID or LABEL. In the latter cases you would need to amend fstab to cater for the new UUID/LABEL but the swapon -a will have failed and you'll already know that.

Oh, and 6.7? No, don't do that. It's old, out of date and has had no updates for about 18 months. You need to run 6.9 which is the only supported version of CentOS 6. Just yum update to get there. There are serious security vulnerabilities present in 6.7.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply