1834814 Members
2448 Online
110070 Solutions
New Discussion

Re: Swap?

 
SOLVED
Go to solution
castro_2
Regular Advisor

Swap?

I have several quiestion about swap?
Can I create swap in diferents vgs?
How can I increase the primery swap?
How can I create the secondary swap commands?
My problem is when I want to create another swap with the sam, I have the error, that I have to compile the new kernel, what parameters I have to change to enable the second swap in the kernel?
Thanks
7 REPLIES 7
Uday_S_Ankolekar
Honored Contributor

Re: Swap?

You should start by reading document available in /usr/share/doc/mem_mgt.txt

You can create swap in different VGs.
Primary can not be increased.
Best way for you to use sam to create secondary swap.

SAM>disk and File systems> swap.. and go from there...
Goodluck...
-USA..
Good Luck..
Michael Tully
Honored Contributor

Re: Swap?

Yes you can create swap in different volume groups.
You can't extend a primary swap partition, but you can create addition ones.
The difference between primary and secondary is simply the priority number given.
The kernel parameter your after is called 'maxswapchunks'. Before we can really recommend a value what do you have now?
# kmtune -l -q maxswapchunks
I've attached a white paper on memory management. It also contains a great deal of information on understanding swap.
Anyone for a Mutiny ?
Jeff Schussele
Honored Contributor

Re: Swap?

Hi castro,

1) Certainly, although swap is at the LV level - not VG.
You just create an LV normally & in it's fstab entry you denote it like
/dev/vgSwap/swap1 ... swap pri=0 0 0

2) Primary can be increased ONLY if you have free space contigous to the existing sawp - highly unlikely. One normally has to Ignite the system & reconfigure on reload to do this. I never increase primary, I normally add more & rearrange priority to give the faster array disks where I'm designating swap a higher priority which means they're used first.

3) swapon -a is the normal command to enable new swap.

4) You're probably bumping up against maxswapchunks - the limit of swap chunks that can be managed. You take that value & the value of swchunk - the size of the chunks in 1K blocks - that value determines the maximum amount of swap you can have until you increase one or the other. I would recommend you increase maxswapchunks. This will require a reboot.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
castro_2
Regular Advisor

Re: Swap?

I have K380 and the maxswapchunks 512.
How much should be increase? To create another swap the 700 MB
S.K. Chan
Honored Contributor

Re: Swap?

- Yes you can.
- Primary swap must be contiguous because the dump space (usually in pri swap) has to be contigous. Since pri swap is defined during OS installation, you'll will not be able find any free contigous extents to extend your pri swap. To extend it you need to use the ignite process. Hence secondary swap space is added if additional swap is needed.
- To create a 400MB 2ndary priority 1 swap space (say /dev/vg01/swap2)..
# lvcreate -L 400 -n swap2 -C y -r n /dev/vg01
# swapon -p 1 /dev/vg01/swap2
# swapinfo -tam
# vi /etc/fstab
....
/dev/vg01/swap2 ... swap pri=1 0 1
....
- The parameter to change is "maxswapchunks".
Michael Tully
Honored Contributor

Re: Swap?

Suggest you increase the value of 'maxswapchunks' to 2048.

As mentioned, the existing primary swap area is contiguous. Attempting to fix this can only be done with an ignite tape with an outage of at least 1-2 hours. I would suggest that you create a second primary swap partition. Our friend SK Chan has provided a good example.
Anyone for a Mutiny ?
S.K. Chan
Honored Contributor
Solution

Re: Swap?

You don;t have to be exact. The formula is ..
max-swap=maxswapchunk*swchunk*1024bytes
The "swchunk" is another kernel parameter (default is 2048 I think). You need to add up all the swap space to determine the total before you can calculate the maxswapchunk needed. For example setting maxswapchunk to 1024 gives ..
1024*2048*1024bytes ie about 2GB of total swap.