System Administration
Showing results for 
Search instead for 
Do you mean 

Swap space implementation on HP-UX

Highlighted
Occasional Contributor

Swap space implementation on HP-UX

Hi all
I am trying to implement a function on HP-UX B 11.11i arch system to find the swap space.
We have a command "swap" in case of Solaris and "free" in case of Linux.
Is there any equivalent command on HP-UX??
I need to know both free as as well as used swap space..
thanks!!
4 REPLIES
Honored Contributor [Founder]

Re: Swap space implementation on HP-UX

Have a look at the swapinfo command.

My preferred usage is 'swapinfo -tam'. 'man swapinfo' for more information.
Honored Contributor [Founder]

Re: Swap space implementation on HP-UX

# swapinfo -tam (* will display total swap and other important metrics about memory utilization. *)

If you want to add swap:

1) lvcreate -L #### -n swap -C y -r n /dev/vg##
-L for size of logical volume in MB. -L 1000, for example.
-n for 'name' of logical volume, for example 'swap'.

2) swapon -f -p 1 /dev/vg##/swap

3) sysdef | grep -i maxswapchunks
Note the size of the kernel parameter 'maxswapchunks'

4) sysdef | grep -i swchunk
Note the size of the kernel parameter 'swchunk'

5) Calculate the new value of 'maxswapchunks'
maxswapchunks = total swap / 1024 * swchunk

If you decide to change maxswapchunks answer back and I'll show you how. And paste in these values so I can verify your calculations.
Support Fatherhood - Stop Family Law
Acclaimed Contributor [Founder]

Re: Swap space implementation on HP-UX

HP-UX has a real curveball with respect to other flavors of UNIX and that is "pseudoswap" -- enabled by setting the kernel tunable swapmem_on=1. Pseudoswap isn't swap at all; it's actually a way of tricking the system into thinking it has more swap than it actually has. Suppose that you have a system with 32GB of physical memory. In order to fully utilize that address space, you would need at least 32GB of device or filesystem swapspace. However, if pseudoswap is enabled then you would need only 8GB of actual swap to fully utilize your 32GB Virtual Address Space. Pseudoswap allows the kernel to count 75% of physical memory as though it were swap space so that 8GB of actual swap + 75% of 32GB = 32GB of VAS. Pseudoswap is displayed in the "memory" line of swapinfo, if pseudoswap is actuually enabled. Many HP-UX boxes have much less swap space than physical memory and work very well. Why configure swap space if it is never going to be used; that's why you bought all that memory in the first place.
If it ain't broke, I can fix that.
Honored Contributor [Founder]

Re: Swap space implementation on HP-UX

my stance on the psuedo-swap thing is that the OS should be smart enough to figure out what to do with it's memory.
if you have 32GB of ram, and only create a swap of 8GB it should figure it out by itself what to do with it. allocate what, where and just do it's thing and don't bother me with such details.