Operating System - HP-UX
1752413 Members
5786 Online
108788 Solutions
New Discussion юеВ

Adding SWAP space on system

 
Mohammad Sanaullah
Frequent Advisor

Adding SWAP space on system

Dear All
I am facing some memory issue and need to increase the swap space.
I came to know that it is not possible to increase the primary swap and need to add secondary swap, fresh swap requirement is upto 10 GB.

# model
ia64 hp server rx6600
OS: HPUX B.11.23

# vgdisplay vg00
--- Volume groups ---
VG Name /dev/vg00
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 9
Open LV 9
Max PV 16
Cur PV 1
Act PV 1
Max PE per PV 4356
VGDA 2
PE Size (Mbytes) 32
Total PE 4322
Alloc PE 3968
Free PE 354
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0

# swapinfo -tam
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 10240 855 9385 8% 0 - 1 /dev/vg00/lvol2
reserve - 9385 -9385
memory 40930 39682 1248 97%
total 51170 49922 1248 98% - 0 -

Please let me now:
1. Can I increase the primary swap
2. If not how to increase the swap on system. using above free space. Please let me know the procedure, does it requires system reboot or any application downtime.

Mohammad Sanaullah
Alive
14 REPLIES 14
TTr
Honored Contributor

Re: Adding SWAP space on system

1. Not easily
2. Add secondary swap using the available space on vg00. See http://forums13.itrc.hp.com/service/forums/questionanswer.do?admit=&threadId=451429 or search for "add secondary swap"
Pete Randall
Outstanding Contributor

Re: Adding SWAP space on system

You can simply add another swap area and set the priorities equal. Probably the easiest way to accomplish this is to use SAM.


Pete

Pete
Steven E. Protter
Exalted Contributor

Re: Adding SWAP space on system

Shalom,

1. Take an ignite backup of vg00. Boot from backup and intervene at the ignite interface to recover with a large swap area.
2. Create a secondary swap area, with sam or command line, activate the swap and reboot the system to complete the process. lvcreate then lvextend -L

A reboot is always required to permanent swap space. You may be able to avoid this by going with an additional file system based swap but this has performance impact.

Note: Creating a swap space larger than twice ram will impede performance. As you have 40 GB of RAM, the minimum recommended total swap space should be 20 GB total.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ganesan R
Honored Contributor

Re: Adding SWAP space on system

Hi Mohammad,

>>>1. Can I increase the primary swap<<<

No, you can't. The reason is that swap filesystem should be contigious.


>>>2. If not how to increase the swap on system. using above free space. Please let me know the procedure, does it requires system reboot or any application downtime.<<

You need to create additional/secondary swap.

If you are not familiar with command line use SAM to create secondary swap. use the below steps.

Creating additional swap :

Findout which volumegroup(VG) is having enough free space using vgdisplay command.

For VG01 use the following command. Look at the values of Free PE and PE size.
PE size*No of Free PE├в s is the space available on that VG

#vgdisplay /dev/vg01

Create the logical volume for your secondary swap.

#lvcreate -L 10000 -n swap -C y -r n /dev/vg01 ->Here the size is 10GB

Once you created the logical volume use SAM to configure it.

#sam
Disks And File Systems
Swap
Actions ->Add Device Swap
Using the Logical Volume Manager

Select the lvol from the list of Unused Logical Volumes

/dev/vg01/swap

select:
When to Enable
[X] Now
[X] At Every System Boot
OK

Then system will rebuilt the kernel and reboot the system.

This is the default selection





Best wishes,

Ganesh.
James R. Ferguson
Acclaimed Contributor

Re: Adding SWAP space on system

Hi:

This question comes up repeatedly.

1. This is not worth the effort to do it when you have a configuration in which you can. Secondary device swap is perfectly good as primary device swap.

See this recent thread:

http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1318283

Regards!

...JRF...
Avinash20
Honored Contributor

Re: Adding SWAP space on system

In your case 9385 / 10240 is being already reserved, i.e, application reserve the space in case if page-outs take place.

But if the memory pressure is high and if free memory is very less to run new process, then there is no use in increasing swap.

You could check the free memory available via

# top

Check the Memory section,,, (XXXX K Free)

Your answers"
1. Take ignite and restore ignite. recommended one, as told above
2. Please create a secondary swap

lvcreate -L 10240 -n myswap -C y -r n /dev/vg00

This will create a LV /dev/vg00/myswap

# swapon -p 1 /dev/vg00/myswap

You could see this swap added via
# swapinfo -tam

Add it to fstab to have it activated across reboot

echo "/dev/vg00/myswap ... swap pri=1 0 1" >> /etc/fstab
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Avinash20
Honored Contributor

Re: Adding SWAP space on system

Hmmm...

44 of 116 points assigned.

Please try to assign points to the thread.
This is a better ways of saying Thanks.
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Shahul
Esteemed Contributor

Re: Adding SWAP space on system

Hi,

To answer your question, Yes, you can increase primary swap. but I would not recommend as it is a complex procedure and require down time. The easiest option is to assign secondary swap as follows. You have got around 11GB free space in vg00.

#lvcreate -L 11328 /dev/vg00
#vi fstab and add a line as follows.

/dev/vg00/lvolnn ... swap pri=2 0 0

here nn is the lovol number. Then
#swapon -a (To enable all swaps in fstab)
#swapinfo -t (To verify)

Make sure that swchunk parameter in Kernel is already set to a large value.

Good luck
Shahul
Mohammad Sanaullah
Frequent Advisor

Re: Adding SWAP space on system

Thanks for all the responces, Points I will surely give to all.

While I am trying to create a logical volume so that I can use the same for swap is giving error to undistribute your volume group, as this system is a node for two node cluster, and I need to add swap space on both the node by 10 GB.

Thanks.
Mohammad Sanaullah
Alive