Operating System - HP-UX
1848564 Members
6643 Online
104033 Solutions
New Discussion

Adding more swap space...

 
Gene Laoyan
Super Advisor

Adding more swap space...

I know how to do this from the SAM GUI but I want to be able to do this from a telnet session/commandline.
I have available space, about 16GB, I want to use for swap space. Could someone give me commandline instructions on how to do this from scratch?

Thanks
9 REPLIES 9
Ivan Krastev
Honored Contributor

Re: Adding more swap space...

See "Managing Swap and Dump" documentation - http://docs.hp.com/en/B2355-90950/ch06s03.html


regards,
ivan
A. Clay Stephenson
Acclaimed Contributor

Re: Adding more swap space...

While you can execute the swapon command using arguments directly, it's actually better to add the entry to /etc/fstab and then execute "swapon -a" because then you know that future reboots will also correctly mount your additional swap. I assume that you have created a strict contiguous LVOL for swap, e.g. /dev/vg01/lvol2

Now edit /etc/fstab and add an entry like this:
/dev/vg01/lvol2 ... swap pri=2 0 0
and save the file. Next execute "swapon -a" and you are done. Man 1m swapon for details.

Now the "gotcha" is that this may fail because the kernel is not configured to utilize the additional swap if this is a version prior to 11.23. You may have to increase maxswapchunks and/or swchunk and build a new kernel.
If it ain't broke, I can fix that.
Kusuniltv
Occasional Advisor

Re: Adding more swap space...

Hi

first create a lv

a) To create the volume manager, execute the following command:
lvcreate â l -C y -n /dev/


Then sam....add the swap space...sam... filemamanger..swap..add swap..

then execute swapon -a
Paul F. Bennett
Advisor

Re: Adding more swap space...

Here are the steps:

lvcreate -L (size in mb) -C y -r n /dev/vgXX (Creating a logical volume for swap)

edit the fstab file ..ie /dev/vgXX/lvolX ... swap pri=1 0

swapon -a

swapinfo -tam (should show new swap)
yulianto piyut
Valued Contributor

Re: Adding more swap space...

just run command swapon -a /dev/vg00/lvswap

lvswap is lv that must be you create for adding swap
# lvcreate -L lv_size -n lvswap /dev/vg00

edit /etc/fstab, add line:
/dev/vg00/lvswap .. swap pri=1 0 0
skt_skt
Honored Contributor

Re: Adding more swap space...

with the default kernel parms we can add upto 32GB swap.

#kmtune|grep -i chunk
maxswapchunks 16384 - 16384
swchunk 2048 - 2048


Also i would say the swap as a dump device too that will help you collect a full crash dump during a TOC/panic.

Action plan: Add vg16/lv3 to the dump configuration for a total of 23.6 GB dump space

1) Verify vg16/lv3 is strict, contiguous and has bad block relocation policy set
to off.

To change the parameters of an existing swap lvol issue
#lvchange -C y -s y -r n /dev/vg16/lv3


2) Add the new dump lvol in /etc/fstab as shown below:
( ie: /dev/ vg16/lv3 ... dump defaults 0 0 )


3) Edit /etc/rc.config.d/crashconf as below:
CRASHCONF_ENABLED=1
CRASHCONF_READ_FSTAB=1
CRASHCONF_REPLACE=0


4) Issue "/sbin/rc1.d/S080crashconf start" to update the dump devices, it
should return EXIT CODE: 0 for a successful operation.


5) To verify your dump configuration issue "crashconf"


For adding a swap space.

Create a separe vg like vgswap
scsictl -m queue_depth=4 (device name got from step above) # Primary Link
scsictl -m queue_depth=4 (alt. device name for above) # Alternate Link

create LV with the properties mentioned above

To enable the swap from command line;

# swapon -p 1 /dev/vgswap/swap
# swapon -p 1 /dev/vgswap/swap1

# vi /etc/fstab and add a line

/dev/vgswap/swap . . . swap pri=1 0 2
and save

# swapinfo.

Confirm there is no error because of the swap removed
# lvlnboot -v
Emil Velez
Honored Contributor

Re: Adding more swap space...


You may not have realized this but SAM works from terminal windows if you terminal type is set correctly and the window is a proper size. Try it. Sam can work in both X and telnet windows. This is one of its major strengths.
Geoff Wild
Honored Contributor

Re: Adding more swap space...

To create swap, you need a contiguous space on a disk/LUN.

Create vg01:

pvcreate /dev/rdsk/c25t0d0
pvcreate /dev/rdsk/c25t2d0
vgcreate -s 8 -p 128 /dev/vg01 /dev/dsk/c25t0d0 /dev/dsk/c25t2d0
vgchange -a y /dev/vg01

lvcreate -C y -L 16384 -n lvswap /dev/vg01

/usr/sbin/swapon -f -p 3 /dev/vg01/lvswap

add to /etc/fstab:

/dev/vg01/lvswap ... swap pri=3 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.
dipesh_2
Regular Advisor

Re: Adding more swap space...

Hi
You need to add additional swap space from your logical volume.

Here are the steps:

lvcreate -L (size in mb) -C y -r n /dev/vgXX/swaplv (Creating a logical volume for swap) (creating contegious and bad block disable)

edit the fstab file ..ie /dev/vgXX/lvolX ... swap pri=1 0

swapon -a (To activate swap)

swapinfo -tam (should show new swap)