1827288 Members
3106 Online
109717 Solutions
New Discussion

Adding device swap

 
SOLVED
Go to solution
DLH
Occasional Advisor

Adding device swap

Can device swap be safely added to a partially filled physical volume in vg00 or is this something that should have been done during installation? The physical volume contains a file system. If this is possible, what is the best procedure. I'm assuming that I would need to create an LV with the contiguous switch and then use some variation of swapon.
7 REPLIES 7
Rainer_1
Honored Contributor

Re: Adding device swap

there's no problem adding additional swap from vg00.
Just create a new lvol and add it to swap.
Possibly you have to increase kernel parameter maxswapchunks.
DLH
Occasional Advisor

Re: Adding device swap

Also, how can I search this forum for previously answered questions?
Rainer_1
Honored Contributor

Re: Adding device swap

use the 'search' link at the upper left corner type your pattern at 'Search for' and set the toggle button 'Community Forums' to on
James R. Ferguson
Acclaimed Contributor

Re: Adding device swap

Hi:

1. Swap performance will be best if the size and priority of multiple swap devices is the same. Adding a second logical volume for swap to VG00 is quite appropriate.

2. To search the Forum, click "Search" on the left side of the ITRC Forum pages and choose "Community Forums" to search.

...JRF...
thinphony
Advisor

Re: Adding device swap

When you enable a swap area within a logical volume, HP-UX determines how large the area is and it will use no more space than that.If your disk has enough remaining contiguous space, you can subsequently increase the size of your primary swap area by using the lvextend command (or SAM) to enlarge the logical volume and then reboot the system. This allows HP-UX to use the extra space that you have provided.If you plan device swap areas in addition to primary swap, you will
attain the best performance when the device swap areas are on different physical volumes (disks). This allows for the interleaving of I/O to the physical volumes when swapping occurs. You set up this swapping configuration by creating multiple logical volumes for swap, each logical volume on a separate disk. You ust use HP-UX commands to help you obtain this configuration; SAM does not allow you to create a logical volume on a specific disk.
DLH
Occasional Advisor

Re: Adding device swap

I'm still not completely clear on how I should create the device swap. I have existing device swap on one physical disk in vg00 and I want to create an equal amount of swap on another physical disk on VG00 which as I previously said has a file system mounted on part of it. Do I have to use the -C option when creating the lv to force the extents to be contiguous? Do I use swapon to assign the lv to be used as swap? I read the man pages on swapon and it's not very clear to me how to use it to create device swap. I guess what I'm asking for is a step by step process for creating the device swap.
thinphony
Advisor
Solution

Re: Adding device swap


Hi,DLH.
first of all , you may need to check the maxswapchunks system parameter which by default allows you to add you swap device at the size of 512MB, if you will config your swap bigger than that, you may need increase the parameter, by sam.
second, create a logical volume on the second PV which will be used as swap. As a primary swap device the LV must be continous area on a disk, but for secondary, no documentation indicates continous nessecity, your condition obviously is the secondary swap.
# lvcreate -n lvswap2 /dev/vgroot
# lvextend -L 200 /dev/vgroot/lvswap2 /dev/dsk/c1t0d0
# swapon /dev/vgroot/lvswap2
(Please read swapon man pages for details, also this will work)

then you should edit the /etc/fstab file to add an entry for the swap device:

/dev/vgroot/lvswap2 / swap defaults 0 0

this guarantee that after a system reboot the new swap device will be automatically swaped on.

use swapinfo to check the swap message, If it doesn't work, try a reboot.

hope this will work.

Good luck & regards.

thinphony