Is it possible to increase swap partition ?

globcom

Well-Known Member
May 24, 2008
57
3
58
Hi,

My swap partition is too small.
I must do a swapoff -a , swapon -a to empty it.

Is it possible to increase swap partition ?
and
How ?

#swapon -s
Filename Type Size Used Priority
/dev/sda7 partition 1048568 8180 -1

Thanks :)
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
Hello :)

It's possible, but not through any cPanel/WHM features. This is an OS-level task that should be handled with care. CentOS provides documentation on this at:

CentOS - Adding Swap Space

Thank you.
 

globcom

Well-Known Member
May 24, 2008
57
3
58
Thank you Mickael

you wrote: "This is an OS-level task that should be handled with care."

If, if I apply the tutorial "5.2.1. Extending Swap on an LVM2 Logical Volume" from your link, what are the risks ?

Regards,
Eric
 

TheJudge

Member
Mar 6, 2014
8
0
1
cPanel Access Level
Root Administrator
Hi,

Usually I would say you should look how much of the swap space is currently used and if you have enough free memory to move that swap space to RAM but since you are already doing swapoff and swapon I assume that you know the risks of doing these two actions.

Besides this, there is no other risk involved in increasing a swap partition.

Regards,
Raul
 

globcom

Well-Known Member
May 24, 2008
57
3
58
Thank you Raul,

I have 64 Go of ram in this server.
I think increase swap partition to 8 or 16 Go.
Could you think is a good choice ?

Eric
 

TheJudge

Member
Mar 6, 2014
8
0
1
cPanel Access Level
Root Administrator
If you can afford 16GB of swap I would go with that option.
Everything beyond 16GB of swap on normal disks(even 15k disks) is a waste in my opinion(at least for this type of services). Why? Because the applications writing that amount(more than 16GB) of pages to swap will definitely suffer performance issues.


Regards,
Raul
 

globcom

Well-Known Member
May 24, 2008
57
3
58
Thank you Raul :)
I will try to increase swap to 16 go this night.

Regards,
Eric