1837897 Members
3250 Online
110123 Solutions
New Discussion

Re: Increasing SWAP

 
SOLVED
Go to solution
Oscar Garcia
Regular Advisor

Increasing SWAP

Hi guys and girls,

I have upgraded my L class server running 11i with 2Gb for a total of 5Gb.
I thought would be good idea to increase the swap too. I tried to make my homework, I read a lot of the posts regarding this and I remember doing it in the past to allocate 1Gb creating lvol2.
Well, the server used to have:
/dev/vg00/lvol2 Device 1 1022 of 1024 now/on boot
/dev/vg00/lvolswap Device 1 2046 of 2048 now/on boot

And I tried to increased lvolswap from 2Gb to 4Gb increasing just the logical volume, which I thought was possible as I thought was not the primary one, but unfortunately it is. Now this is how it looks like (lvdisplay -k -v):

LV Name /dev/vg00/lvolswap
VG Name /dev/vg00
LV Permission read/write
LV Status available/syncd
Mirror copies 0
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 4000
Current LE 1000
Allocated PE 1000
Stripes 0
Stripe Size (Kbytes) 0
Bad block on
Allocation strict
IO Timeout (Seconds) default

--- Distribution of logical volume ---
PV Name LE on PV PE on PV
/dev/dsk/c1t0d0 1000 1000

But this did not increased the swap in the system… The question here is how to fixed it? I think I need to create a new lv for swap but also I want to recover those 2Gb, what do I need to do?

Thanks in advance
12 REPLIES 12
Victor BERRIDGE
Honored Contributor

Re: Increasing SWAP

Hi Oscar,

Did you reboot after?
I suppose it may only be you will have to generate a new kernel with appropriate value for maxswapchunks
lets say 6000 will give plenty of freedom...

By the look of it you may well finish up with 5GB swap...

All the best
Victor
Oscar Garcia
Regular Advisor

Re: Increasing SWAP

Thanks Victor,

I have not rebooted the system yet as I have almost 10 Oracle instances running and it is a bit of a job for the dba to start them up/shut them down, besides is a new chap.

I am getting a bit worried as my maxswapchunks is just 1536. How do you calculate the size?

Also I have found in other post that the primary can be increased ONLY if you have free space contigous to the existing swap. Well, how do you know is contigous? and How do you increase it? The only thing I know is that they were in the same volume group vg00 and that there was free space there...
Geoff Wild
Honored Contributor

Re: Increasing SWAP

lvdisplay /dev/vgXX/lvolX |grep Allocation

to see if it is strict/contiguous:

Example:

lvdisplay /dev/vg00/lvol2 |grep Allocation
Allocation strict/contiguous


If you need more swap, I just create a new one...

Example - adding a 10 GB swap:

lvcreate -L 10240 -n lvswap /dev/vg00
swapon -f /dev/vg00/lvswap

then add to /etc/fstab:

/dev/vg00/lvswap ... swap pri=1 0 0


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
CAS_2
Valued Contributor

Re: Increasing SWAP

I think you should run the swapon command on the extended logical volume.
Oscar Garcia
Regular Advisor

Re: Increasing SWAP

I have run it and it comes with:
$ swapon -f /dev/vg00/lvolswap
swapon: /dev/vg00/lvolswap is already enabled for paging.

but if I do the swapinfo:

$ swapinfo -tam
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 1024 23 1001 2% 0 - 1 /dev/vg00/lvol2
dev 2048 23 2025 1% 0 - 1 /dev/vg00/lvolswap
reserve - 1339 -1339
memory 3883 3047 836 78%
total 6955 4432 2523 64% - 0 -

Victor BERRIDGE
Honored Contributor

Re: Increasing SWAP

maxswapchunks * swchunk * DEV_BSIZE = max swap space
If you have the default values of swchunk and DEV_BSIZE with maxswapchunks of 1536 it should give you about 3.2 GB of swap since setting this parameter is only going to cost you a reboot, fix it high enough for future needs af swap so 5000 should bring you to about 10GB...

swapon will only work if you are adding a new swap device...


All the best
Victor
CAS_2
Valued Contributor

Re: Increasing SWAP

Now you need to increase maxswapchunks kernel parameter and reboot.

The current value (1536) means 3 GB. This is the current upper limit for your kernel.

The formula may be simplified as:

maxswapchunks >= size_in_MB / 2

note: that 2 means 2 MB (the default size of a chunk set by the default value of swchunk kernel parameter).

I suggest to double the current value in order to let the kernel to handle up to 6 GB of swap. So, next time you'll need to add more swap (up to 6GB), you will not need to reboot again.
Oscar Garcia
Regular Advisor

Re: Increasing SWAP

Thank you all for your replies.

I am going to increase the maxswapchunks as you suggested it.

What still puzzles me is if after the reboot I will have the extra 2Gb that I need. Checking if it is continous:

$ lvdisplay /dev/vg00/lvolswap|grep Allocation
Allocation strict

It comes just with strict and it seems it has to be "Allocation strict/contiguous".
Lets clarify something, increasing the space of the logical volume lvolswap was wrong, now I need to rectify it.
Victor BERRIDGE
Honored Contributor

Re: Increasing SWAP

Well Oscar,
If you really want swap guarantied there is nothing stopping you to create yet another swap space this time of the correct size then use swapon but since you dont have the right value of maxswapchunks it can be only used at next reboot the idea here is then you can try to not use the other swap at next reboot and after remove it and so you recuperate your 1000PE again.
Now you havent said how the rest is configured because to make the swap the most efficient, you should have different swap on different disks (Pv etc) accessed by different controllers but of SAME SIZE...
So it is for performance better to have 3 swaps of 2 GB than one of 1GB and the other of 4...

All the best
Victor
Dreaming of a pint of BRAINS
(Is it exported?)
Oscar Garcia
Regular Advisor

Re: Increasing SWAP

Thanks Victor,

The plan was to have:
/dev/vg00/lvol2 of 1Gb (primary)
/dev/vg00/lvolswap of 4Gb

But if the recommendation is to have the same size, well I am stuffed. I think I just can go for 1,2,2... and the last one would be in a different disk.

The primary swap (lvol2) looks like:
$ lvdisplay -k -v /dev/vg00/lvol2
--- Logical volumes ---
LV Name /dev/vg00/lvol2
VG Name /dev/vg00
LV Permission read/write
LV Status available/syncd
Mirror copies 0
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 1024
Current LE 256
Allocated PE 256
Stripes 0
Stripe Size (Kbytes) 0
Bad block off
Allocation strict/contiguous
IO Timeout (Seconds) default

So it is in the same vg and in the same Pv...

Sorry I still haven't got idea of how I am gonna get back those 2Gb. Let me see if I got it right:

1- I will reboot the server
2- Somehow I will remove the 2Gb.
3- Change the maxswapchunks to 3000
4- Create the 2Gg of swap in another disk using swapon.
5- Reboot again.

Cheers,



Victor BERRIDGE
Honored Contributor
Solution

Re: Increasing SWAP

Oscar,
start by modifying using SAM the value of maxswapchunks
make it 4000 like that you have some spare and it may save you a reboot in the future...
Once rebooted, go to "disk and file system"/swap, create 2 swaps of 2GB in different VGs, and remove the 4GB one and since vg00/lvol2 is now smaller, change its priority in favor of the 2 new ones..
Now you shall reboot again
And all should be fine

All the best
Victor

Oscar Garcia
Regular Advisor

Re: Increasing SWAP

Thanks Victor for your help!