cancel
Showing results for 
Search instead for 
Did you mean: 

SwapSpace increase

SOLVED
Go to solution
mehul_3
Regular Advisor

SwapSpace increase

Could anybody tell me how to increase a swapspace? Pl send simmple steps to perform with example


Thanks in advance.

Regards
mehul
12 REPLIES
Sivakumar TS
Honored Contributor

Re: SwapSpace increase

would create a separate vg for it. After that you can do this to create your addl swap.

Hi Mehul,

You can create and add a secondary SWAP in the system.

Follow the below procedure...

1. # lvcreate -L 400 -n swap1 -C y -r n /dev/vg00

==> this creates a 400MB contigous lv called swap1 in vg00 with bad block reallocation turned off

2. # swapon -p 1 /dev/vg00/swap1

==> enable swap with priority 1.

3. # swapinfo -ta

==> check to see if added swap is enabled.


# vi /etc/fstab
....
/dev/vg01/swap2 ... swap pri=1

==> this makes the change persistent accross reboots,

With Regards,

Siva.
Nothing is Impossible !
mehul_3
Regular Advisor

Re: SwapSpace increase

Ok thanks but few more questions..
We have already swapspace of 6GB installed and this can be shown from the following output and I would like to add an addtional 3GB space on existing one.
# swapinfo -atm
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 6144 47 6097 1% 0 - 1 /dev/vg00/lvol2
reserve - 3672 -3672
memory 2315 451 1864 19%
total 8459 4170 4289 49% - 0 -

Thanks in advance.
Waiting for your prompt response.

Regards,
Mehul
Yogeeraj_1
Honored Contributor

Re: SwapSpace increase

hi mehul,

easiest way though will be using SAM.

SAM Areas:
Disks and File Systems:
SWAPS

You may as well create additional new swaps!

hope this helps!

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Mark Nieuwboer
Esteemed Contributor

Re: SwapSpace increase

Hi mehul,

You can not easily put more space to you exicting swap.
This is because it's a LV put in place when you install your OS and there for it's protected with a sxtrict allocation policy.
There are ways to go by it but it's not recommanded. There for it's beter to add additional swap as explained. Or ignite your system and make your swap space bigger at the beginning.

Alse when you add additional swap make the kernel change
swapmem=0
tp swapmem=1

Also a document about swap and pseudoswap.
I found it very helpfull.

grtz. Mark
Mark Nieuwboer
Esteemed Contributor

Re: SwapSpace increase

Hi mehul,

You can not easily put more space to you exicting swap.
This is because it's a LV put in place when you install your OS and there for it's protected with a sxtrict allocation policy.
There are ways to go by it but it's not recommanded. There for it's beter to add additional swap as explained. Or ignite your system and make your swap space bigger at the beginning.

Alse when you add additional swap make the kernel change
swapmem=0
tp swapmem=1

Also a document about swap and pseudoswap.
I found it very helpfull.

grtz. Mark
mehul_3
Regular Advisor

Re: SwapSpace increase

Can I simply add space using option add device swap thru SAM. will it allow me to do so?


Regards,
Mehul
mehul_3
Regular Advisor

Re: SwapSpace increase

shall I use modify option thru SAM? instead of doing it by manual command
Mark Nieuwboer
Esteemed Contributor

Re: SwapSpace increase

Yes mehul,

You can do it through sam.
But i'm a prompt geek. i like to do it through the prompt. But no problems to do it by sam.

grtz. mark
mehul_3
Regular Advisor

Re: SwapSpace increase

I have done a following steps to add a swapspace to existing one

$lvlnboot -v /dev/vg00
This will display the current root and swap volumes
(Note: lvol2 is the default primary swap.)
$ lvrmboot -s /dev/vg00
# remove the swap link to the current primary swap.
REBOOT the system into lvm maintenance mode:
$ shutdown -r 0
# reboot

at ISL> boot -lm (;0)/stand/vmunix

$ lvextend -L 12000 /dev/vg00/lvol2 # YYY is new size of lvol
$ lvlnboot -s lvol2 /dev/vg00
# recreate a swap link with the lvol.
$ lvlnboot -R /dev/vg00
# to relink everything
$ shutdown -r 0
# reboot

We have already a enough free space of 15GB in dev/vg00 but surprisingly enough I was unable to extend logical volume giving error message as there is no contigious space.Is it a fragmentation problem.
Pl, guide me in this regard

Thanks
Mehul

Senthil Kumar .A_1
Honored Contributor
Solution

Re: SwapSpace increase

Hi Mehul,

For obvious reasons, the steps you followed will fail because, ROOT ,SWAP/DUMP are supposed to be contiguous allocated logical volumes. Since root vol is lvol3 following the swap vol which is lvol2 it is quite defficult to extend the primary swap lvol2 even if it possible.

The Best solution is to leave the primary swap as it is and add some secondary swap to supplement the already configured priamry swap.

Please read on...

You can configure 2 type of secondary swaps..

1) Device swaps.
2) Filesystem swaps.


I would suggest Device swap to be hassle free and would advice you to go ahead with FS swap only if you do not have enough free extents to create an additional LV in VG00.

following are the commands

1) lvcreate -L vg00 (lets assume it would create /dev/vg00/lvol10)
2) issue the following command to enable the swap..
swapon /dev/vg00/lvol10
You can check whether a swap was added or not by issuing the command "swapinfo".
3) Now you need to make this swapon activity automatic to be done across boots by adding the follwoing line in the /etc/fstab file.

/dev/vg00/lvol10 - swap defaults 0 0

Regards,
Senthil Kumar .A
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
Nguyen Anh Tien
Honored Contributor

Re: SwapSpace increase

this is command option. I prefer!
Device swap:
Device swap is faster than file system swap. Device swap resides in its own partition.
steps:
the following command creates a file system on a disk and reserves 200 megabytes
(MB) for swap:
#newfs -R 200 /dev/rdsk/c0t2d0
#swapon /dev/dsk/c0t2d0
File System Swap
File system swap is a form of secondary swap. It can be configured dynamically.
Steps:
#lvcreate -L 16 -n myswap /dev/vg01
#swapon /dev/vg01/myswap

Several kernel tunable parameters limit the amount of swap that can be made available.
â ¢ The default maximum amount of swap space you can configure, for both device swap and
file system swap combined, is approximately 512 MB. The tunable system parameter,
maxswapchunks, controls this maximum. This parameter (default value of 256) limits the
number of swap space chunks. The default size of each chunk of swap space is 2 MB. The
size of a swapchunk can be modified with the swchunk kernel tunable parameter.
HP is simple
mehul_3
Regular Advisor

Re: SwapSpace increase

Thanks for all of you for kind support.
Problem has been resolved by creating new logical volume for new swap rather than adding to existing one.

Thanks once again all of you for updating my knowledge.

Regards,
Mehul