HP-UX System Administrator's Guide: Logical Volume Management (5900-3028, March 2013)
Administering primary Swap Logical Volumes
NOTE: Version 2.0 and 2.1 volume groups do not support configuring primary swap logical
volume through lvlnboot(1M) command. However they do support configuring swap logical volume
through swapon(1M) command. Please refer the section ““Administering secondary Swap Logical
Volumes” (page 102)
When you enable a swap area within a logical volume, HP-UX determines how large the area is,
and it uses no more space than that. If your disk has enough remaining contiguous space, you
can increase the size of your primary swap area by using the lvextend command (or HP SMH)
to extend the logical volume, then reboot the system. This procedure allows HP-UX to use the extra
space.
If you plan device swap areas in addition to primary swap, you get the best performance when
the device swap areas are on different physical volumes. This configuration allows for the
interleaving of I/O to the physical volumes when swapping occurs.
To create interleaved swap, create multiple logical volumes for swap, with each logical volume
on a separate disk. You must use HP-UX commands to help you obtain this configuration. HP SMH
does not allow you to create a logical volume on a specific disk. See “Extending a Logical Volume
to a Specific Disk” (page 54).
You can configure your swap space as described in HP-UX System Administrator's Guide: Overview.
NOTE: You must reboot the system for the system to recognize changes to the swap configuration.
Creating a Swap Logical Volume
To create a swap logical volume, use the lvcreate command. You must set a contiguous allocation
policy using the -C y option. For example:
# lvcreate -C y -n swap_lvol /dev/vgnn
For more information, see lvcreate(1M).
If you create a logical volume to use as primary swap, use the lvlnboot command with the -s
option to update the swap information used by LVM at boot. For example:
# lvlnboot -s /dev/vgnn/swap_lvol
Extending a Swap Device
If you are using a logical volume for swap, you must increase the logical volume size before
increasing the swap size. You can extend the logical volume using lvextend or HP SMH.
Swap logical volumes must be contiguous, so extending the logical volume succeeds only if there
are physical extents available at the end of the existing logical volume. If contiguous disk space
is not available, create a new contiguous logical volume for primary swap within the root volume
group. You do not need to designate a specific disk. For example:
# lvcreate -C y -L 48 -n pswap /dev/vgroot
After creating a logical volume to use as primary swap, use lvlnboot to update the boot
information:
# lvlnboot -s /dev/vgroot/pswap
WARNING! Configure swap space twice the size of RAM. As you increase the swap size, the
consumption of physical memory for storing swap sub system’s internal tables will also increase.
For a 1 TB swap, nearly 2.5 GB of physical memory is consumed. Configuring bigger swap on
low memory system may lead to boot failure. For a 1 TB swap, ensure that the system has at least
32 GB of RAM for a successful boot-up. While this configuration will boot up, it will run out of
physical memory faster than it would if the admin had configured less swap. Unless there are
definite needs, avoid increasing the swap size just because the boot disk has more free space.
Administering Swap Logical Volumes 101