1819575 Members
2880 Online
109603 Solutions
New Discussion юеВ

Extending Swap Space

 
SOLVED
Go to solution
Vipin K Gupta
Occasional Advisor

Extending Swap Space

Hi,

I need to analyse the impacts for extending swap space.

I am having 8GB swap space. There 3 secondary space.
For extending swap should I extend the secondary space or create a new secondary swap?

Do I need contigous space for creating new secondary space?

What are other prerequisites apart from free PE's available for extending swap?

Thanks!!!
18 REPLIES 18
Manix
Honored Contributor

Re: Extending Swap Space

Hello Vipin !!

You can not extend swap lv on a fly , yes lvol can be extended but "swapon -a " wont see it , you do need contagious extents to extend that lvol & reboot is needed as well.

Best idea is to use equal sizes disk chucks a
on a similar device preferably to create newswap devices and run "swapon -a" after making entries in /etc/fstab.

"lvcreate -c y -b n -n XXXM lvolname " is used
to create a new swap device.

Do post further queries.

Thanks
Manix

HP-UX been always lovable - Mani Kalra
Manix
Honored Contributor
Solution

Re: Extending Swap Space

Hey !! just correcting the "switches" to be used

# lvcreate -C y -r n -L 8192 -n lvolN /dev/vgXX
# swapon -p /dev/vgXX/lvolN

And do check is maxswapchunks large enough for the increased swap; if not, you will need to build a new kernel and reboot.
HP-UX been always lovable - Mani Kalra
Vipin K Gupta
Occasional Advisor

Re: Extending Swap Space

Hi,

Thanks for the reply.

Here I would like to ask a question

DO I need a separate disk for creating new swap.

I am having 4 disk out of which 2 are mirror disks.

I need to create 16 GB swap lv, and I am having 15 GB available in 1disk and 13 GB available on another disk.

What to do in this case.
Manix
Honored Contributor

Re: Extending Swap Space

No you don`t need separate disks to create secondary swap .You have 2 disks which are mirrored to each other it means they must be boot disks ( i guess so ) others must have some
data.

send output for vgdisplay -v vg00 & swapinfo -tam


Do you enabled 'swapmem_on' for "pseudo swap" 75% of your physical memory will be counted by the kernel as available swap space.

Thanks
Manix
HP-UX been always lovable - Mani Kalra
Manix
Honored Contributor

Re: Extending Swap Space

>>this is good one too - ))

>>I have assigned points to 0 of 15 responses to my questions.
HP-UX been always lovable - Mani Kalra
Vipin K Gupta
Occasional Advisor

Re: Extending Swap Space

/root# vgdisplay -v vg01
--- Volume groups ---
VG Name /dev/vg01
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 12
Open LV 12
Max PV 16
Cur PV 4
Act PV 4
Max PE per PV 4341
VGDA 8
PE Size (Mbytes) 4
Total PE 17360
Alloc PE 6512
Free PE 10848
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0

--- Logical volumes ---
LV Name /dev/vg01/swap1
LV Status available/syncd
LV Size (Mbytes) 1000
Current LE 250
Allocated PE 500
Used PV 2

LV Name /dev/vg01/swap2
LV Status available/syncd
LV Size (Mbytes) 1000
Current LE 250
Allocated PE 500
Used PV 2

LV Name /dev/vg01/tmp
LV Status available/syncd
LV Size (Mbytes) 1000
Current LE 250
Allocated PE 500
Used PV 2

LV Name /dev/vg01/home
LV Status available/syncd
LV Size (Mbytes) 500
Current LE 125
Allocated PE 250
Used PV 2

LV Name /dev/vg01/localcw
LV Status available/syncd
LV Size (Mbytes) 900
Current LE 225
Allocated PE 450
Used PV 2

LV Name /dev/vg01/orahome
LV Status available/syncd
LV Size (Mbytes) 500
Current LE 125
Allocated PE 250
Used PV 2

LV Name /dev/vg01/oravar
LV Status available/syncd
LV Size (Mbytes) 200
Current LE 50
Allocated PE 100
Used PV 2

LV Name /dev/vg01/patrol
LV Status available/syncd
LV Size (Mbytes) 1024
Current LE 256
Allocated PE 512
Used PV 2

LV Name /dev/vg01/openv
LV Status available/syncd
LV Size (Mbytes) 2000
Current LE 500
Allocated PE 1000
Used PV 2

LV Name /dev/vg01/EMC
LV Status available/syncd
LV Size (Mbytes) 800
Current LE 200
Allocated PE 200
Used PV 1

LV Name /dev/vg01/swap3
LV Status available/syncd
LV Size (Mbytes) 3000
Current LE 750
Allocated PE 750
Used PV 1

LV Name /dev/vg01/lvol10
LV Status available/syncd
LV Size (Mbytes) 3000
Current LE 750
Allocated PE 1500
Used PV 2


--- Physical volumes ---
PV Name /dev/dsk/c3t2d0
PV Status available
Total PE 4340
Free PE 3234
Autoswitch On
Proactive Polling On

PV Name /dev/dsk/c3t3d0
PV Status available
Total PE 4340
Free PE 3915
Autoswitch On
Proactive Polling On

PV Name /dev/dsk/c8t2d0
PV Status available
Total PE 4340
Free PE 1034
Autoswitch On
Proactive Polling On

PV Name /dev/dsk/c8t3d0
PV Status available
Total PE 4340
Free PE 2665
Autoswitch On
Proactive Polling On
Vipin K Gupta
Occasional Advisor

Re: Extending Swap Space

Kindly check the output of vgdisplay.
Manix
Honored Contributor

Re: Extending Swap Space

got late due to network disconnect .. yes i may see that there are three swap devices swap 1 ,2 & 3 of ( 1 + 1 + 3 = 5 gigs ), rest would be primary swap.

It would be better if you have created couple of equally sized swap devices rather then spreading them around.

Please post output for swapinfo -tam as I requested earlier to help you further.

Thanks
Manix

HP-UX been always lovable - Mani Kalra
Vipin K Gupta
Occasional Advisor

Re: Extending Swap Space

(root):/root# swapinfo -atm
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 3000 0 3000 0% 0 - 1 /dev/vg00/swap
dev 1000 0 1000 0% 0 - 0 /dev/vg01/swap1
dev 1000 0 1000 0% 0 - 0 /dev/vg01/swap2
dev 3000 0 3000 0% 0 - 0 /dev/vg01/swap3
reserve - 8000 -8000
memory 32768 12373 20395 38%
total 40768 20373 20395 50% - 0 -
Manix
Honored Contributor

Re: Extending Swap Space

You have configured secondary swap at low priority for non vg00 secondary swap which is not a very good idea.

Edit /etc/fstab and add the entry for each of them like this.

/dev/vg??/lv?? ... swap pri=1 0 0

This will enable swap interleaving as primary swap is already set to the default priority of 1.

(lowest number such as 0 gets used first, equal priorities are assigned in round-robin manner).

Further you have 32 Gigs of "pseudo swap" so it means your RAM size should be 50 Gigs which is good , you need to configure swap space at least equal to physical memory.

Check " dmesg | grep -i physical" to check RAM size and make sure you have equal amount of swap.

Look right now 8 Gigs of swap is reserved by some database application i guess.

You have 43 Gigs of free space in vg01 , please go ahead and good amount of swap to make it equal to RAM size ( or as much as you can, i think you need 42 Gigs..- )

Thanks
Manix

HP-UX been always lovable - Mani Kalra
Kavita Poonia
Regular Advisor

Re: Extending Swap Space

>> You can not extend swap lv on a fly , yes lvol can be extended but "swapon -a " wont see it , you do need contagious extents to extend that lvol & reboot is needed as well.



Secondary device swap in your case can be extended on same disk or new disk online with lvextend & swapon -a command. No reboot is required for swapon -a. Then its not necessary for secondary device swap to be contiguous but primary swap has to be.

Thanks & regards,
Kavita
Manix
Honored Contributor

Re: Extending Swap Space

>>>>> You can not extend swap lv on a fly , yes lvol can be extended but "swapon -a " wont see it , you do need contagious extents to extend that lvol & reboot is needed as well.

>>you do need contagious extents to extend ..>>that<< lvol

Hello Kavita

Thanks for checking in but these comments were only for "primary swap" that can`t be extended on fly and needs contagious extents ( if possible ..with certain work around )+ reboot.

Not for secondary do check the same -- ))

Thanks
Manix
HP-UX been always lovable - Mani Kalra
Kavita Poonia
Regular Advisor

Re: Extending Swap Space

Sorry my mistake....Manix is correct....I thought you need to create new sec. device swap which is online but for extending existing device swap you need to do swap off & extend it which is offline activity.

Thanks & regards,
Kavita
Vipin K Gupta
Occasional Advisor

Re: Extending Swap Space

Hi,

I just need to extend swap to 32 GB.

I can create a new swap or I can extend the existing secondary swap.

I got confused.

Conclusion - We can extend the existing secondary swap online right???

Thanks
Vipin
Manix
Honored Contributor

Re: Extending Swap Space

Better create new swap devices as per requirement & don`t get confused !!

Secondary can be extended ( needs reboot after that ) and we need to check what option you used while creating it ( -c y ) & do the things accordingly.

As we already discussed ,create new swap devices .

Thanks
Manix

HP-UX been always lovable - Mani Kalra
223848
Frequent Advisor

Re: Extending Swap Space

Hi Manix,
I have one doubt,
If i created a secondary swap without -C y option, can i extend the swap with lvextend.

What i understood is.
If i created the secondary swap without -C y option, then i have to do swapoff on that LV.
Then i have to extend the LV

Then i have to do swapon on that LV.

Is my undestanding is ryt?
Manix
Honored Contributor

Re: Extending Swap Space

Hello Laiju !

I am not able to find any HP doc ,supporting that secondary swap can be non - contagious.

But 'swapoff' is not a native in built command & there is patch for 11.31 only (AFAIK).read the link below.

https://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=SwapoffEn

I would still prefer to keep add a new device for -C y option .

Thanks
Manix


HP-UX been always lovable - Mani Kalra
223848
Frequent Advisor

Re: Extending Swap Space

Thank you Manix