Operating System - HP-UX
1833313 Members
2834 Online
110051 Solutions
New Discussion

Re: Configure additional swap ?

 
SOLVED
Go to solution
Jerry_109
Super Advisor

Configure additional swap ?

HP-UX B.11.11 U 9000/800/rp4440
####################################

Hello All,

I have (2) questions :

first question :
I have been using SAM to add swap in the past. I noticed the following (2) commands used by some admins. Do these commands seem safe to use :

1)
lvcreate -l 256 -n swap2 -m 1 /dev/vg00
swapon -a
or

2)
lvcreate -r N -C y -s y -n swap2 -L 8192 /dev/vg00
lvextend -m 1 /dev/vg00/swap2 /dev/dsk/c2t1d0

second question :
If you view the following lvdisplay, there is a lv ( swap1 ) listed, but it does not show up in the swapinfo. Why is this, and can I add it so it will display in the swapinfo.

Thanks Jerry



####################################
current :

# swapinfo -tam
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 4096 0 4096 0% 0 - 1 /dev/vg00/swap
reserve - 4096 -4096
memory 41897 23716 18181 57%
total 45993 27812 18181 60% - 0 -
###################################

# vgdisplay -v /dev/vg00 | more
--- Volume groups ---
VG Name /dev/vg00
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 11
Open LV 11
Max PV 16
Cur PV 2
Act PV 2
Max PE per PV 4384
VGDA 4
PE Size (Mbytes) 16
Total PE 8748
Alloc PE 4116
Free PE 4632
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0

--- Logical volumes ---
LV Name /dev/vg00/stand
LV Status available/syncd
LV Size (Mbytes) 400
Current LE 25
Allocated PE 50
Used PV 2

LV Name /dev/vg00/swap
LV Status available/syncd
LV Size (Mbytes) 4096
Current LE 256
Allocated PE 512
Used PV 2

LV Name /dev/vg00/swap1
LV Status available/syncd
LV Size (Mbytes) 4096
Current LE 256
Allocated PE 512
Used PV 2
##########################################
# cat /etc/fstab
# System /etc/fstab file. Static information about the file systems
# See fstab(4) and sam(1M) for further details on configuring devices.
/dev/vg00/root / vxfs delaylog 0 1
/dev/vg00/stand /stand hfs defaults 0 1
/dev/vg00/home /home vxfs delaylog 0 2
/dev/vg00/opt /opt vxfs delaylog 0 2
/dev/vg00/scif /SCIF vxfs delaylog 0 2
/dev/vg00/tmp /tmp vxfs delaylog 0 2
/dev/vg00/usr /usr vxfs delaylog 0 2
/dev/vg00/var /var vxfs delaylog 0 2
/dev/vg00/crash /var/adm/crash vxfs delaylog 0 2
/dev/vg01/u00 /u00 vxfs delaylog 0 2
/dev/vg01/u01 /u01 vxfs delaylog 0 2
/dev/vg01/u02 /u02 vxfs delaylog 0 2
/dev/vg01/u03 /u03 vxfs delaylog 0 2
/dev/vg01/u04 /u04 vxfs delaylog 0 2
/dev/vg01/u05 /u05 vxfs delaylog 0 2
/dev/vg01/u06 /u06 vxfs delaylog 0 2
/dev/vg01/backup /backup vxfs delaylog 0 2

###################################




6 REPLIES 6
James R. Ferguson
Acclaimed Contributor
Solution

Re: Configure additional swap ?

Hi Jerry:

The commands:

# lvcreate -r N -C y -s y -n swap2 -L 8192 /dev/vg00
# lvextend -m 1 /dev/vg00/swap2 /dev/dsk/c2t1d0

...are quite safe. The first one creates a logical volume that has no bad-block relocation; uses contiguous allocation; and uses strict allocation to keep mirror copies on separate physical volumes. This is what is needed for device swap space. The second command creates a mirrored copy of the logical volume just created. After all, you don't want a failure in a single copy of a swap file to crash your system.

With regard to the second question, the 'swap1' secondary swap device doesn't appear in the 'swapinfo' output because it wasn't included in '/etc/fstab' and thus wan't (re)activated during a boot.

You can activate immediately and in an on-going way (across boots) by doing:

# swapon -p 0 /dev/vg00/swap1

# echo "/dev/vg00/swap1 ... swap pri=0 0 0" >> /etc/fstab

See the manpages for 'lvcreate' and 'swapon' for more information.

Regards!

...JRF...
Ninad_1
Honored Contributor

Re: Configure additional swap ?

Hi Jerry,

First of all I appreciate how well you have put all the information required to answer your questions. This shows that you have taken the effort to read through and understand what you need and are asking for the team to confirm that and guide you.

JRF has already provided asnwers to your questions and there cannot be any further additions to that. Except that I would like to make you aware of few more things while adding swap - you need to check your kernel params - maxswapchunks (and swchunk ) to see if maxswapchunks * swchunk is greater than the actual swap area that you wish to allocate. If not increase the maxswapchunks parameter.
If the above conditions are satisfied, since you already have swap1 defined you can go ahead and add it online and make entry in /etc/fstab for it to get activated each time system boots.

Regards,
Ninad
Jerry_109
Super Advisor

Re: Configure additional swap ?

Thanks for the information. My confidense is growing. Seems like the commands would be:

1)
# lvcreate -r N -C y -s y -n swap2 -L 8192 /dev/vg00

2)
# lvextend -m 1 /dev/vg00/swap2 /dev/dsk/c2t1d0

3)
# swapon -p 0 /dev/vg00/swap2

4)
# echo "/dev/vg00/swap2 ... swap pri=0 0 0" >> /etc/fstab

****** I plan on lvremoving the swap1 *****
################################
question :
Why do some admins use "swapon -a" ?

################################

These are the (4) kernel parms I plan to change

current :
# kmtune | egrep "dbc|maxswapchunk|swchunk"
dbc_max_pct 5 - 5
dbc_min_pct 20 - 20
maxswapchunks 4096 - 4096
swchunk 2048 - 2048


new:
dbc_max_pct=5
dbc_min_pct=2

maxswapchunk=16384
swchunk=4096

question:
I heard you could kmtune to change kernel parms? I tried the following, but received an error for the "kmtune -u -s dbc_min_pct=2"

# kmtune -l -q dbc_min_pct
Parameter: dbc_min_pct
Current: 20
Planned: 20
Default: 5
Minimum: -
Module: -
Version: -
Dynamic: No


# kmtune -u -s dbc_min_pct=2
kmtune: dbc_min_pct cannot be set dynamically.

Does this mean I have to use SAM ?


Victor BERRIDGE
Honored Contributor

Re: Configure additional swap ?

Hi Jerry,

>Why do some admins use "swapon -a" ?

This is the way you activate, or if you prefer enable device on which paging is to take place...
Do a
man 1m swapon

Next question:
Yes you can use kmtune but it doesnt tune all the parametersn only the one that can be done dynamically, the same is true with SAM:
if you change a "static" kernel parameters, sam will ask you a new kernel build and a reboot...


All the best
Victor
Jaime Bolanos Rojas.
Honored Contributor

Re: Configure additional swap ?

Jerry!

The swapon -a command is explained in the swapon man(1):

"-a Cause all devices marked as swap and all file systems marked as swapfs in the file /etc/fstab to be made available to the paging system"

And to the second question, yes, kmtune is used to set, modify kernel parameters, but there is a sequence of commands to follow to change static kernel parameters, your best option is to go with SAM.

Regards,

Jaime.
Work hard when the need comes out.
Victor BERRIDGE
Honored Contributor

Re: Configure additional swap ?

Next question:

Im the one not clear here!
>kmtune: dbc_min_pct cannot be set dynamically.
>Does this mean I have to use SAM ?

Not necessarily but its the safest (It will check for inconsistencies)

The other option would be modify a system file and generate a new kernel:
My method (standard... maybe obsolete?)
cd /stand/build
/usr/lbin/sysadm/system_prep -s system #generate a system file
vi system # and modify the parameters you wanted
/usr/sbin/mk_kernel -s system
mv /stand/vmunix /stand/vmunix.prev
mv /stand/system /stand/system.prev
mv vmunix_test /stand/vmunix # the new kernel you just done!
mv system /stand/.

Then you reboot
You can use kmupdate also (but I wanted to describe all the process...)
So do a man kmupdate

All the best
Victor