Adding extra or secondary swap in HPUX

When system runs low on memory and swap continuously, its time to troubleshoot. Even after troubleshooting and all available app/OS tuning you are still running out of memory then you can try adding extra swap before you think of adding RAM to server which involves cost/resources of parent machine.

Step 1.

For adding extra swap check how much space you have available in root volume group vg00. Use vgdisplay command to get free PE and PE size numbers.

Here we have 566 free PE with 16MB size of each. This sums upto 8.8GB of free space in root vg. We can use space from this 8.8GB for adding extra swap.

Check current swap configuration. Here you can see like default HPUX configuration, lvol2 is mounted as swap.

Step 2.
Create new contiguous logical volume with no bad block relocation policy and size of your requirement. Lets make a LV of 2GB.

Step 3.
Start swap on this lvol. Add -f argument to start forcefully if below command fails.


Step 4.
Edit /etc/fstab to mount this LV as swap on every boot. Add below entry :

Step 5.

Check again swap size. Now you can see new lvol is added in swap.

Any thoughts?