How to remove primary swap on HP-UX 11iv3 online

By Dusan Baljevic ()

Remove primary swap and move it into another volume group. To remove the primary swap, we need to ensure that the new swap device has at least enough space that “reserve” requires. Otherwise, swapoff(1M) command will fail!

Step 1: Add new primary swap (can be in other VG but that is strongly not recommended!)

# lvcreate -C y –r n -L 8192 -n lvswap2 /dev/vgswap

# swapon -f /dev/vgswap/lvswap2

# swapinfo -tm

Mb Mb Mb PCT START/ Mb

TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME

dev 8192 0 8192 0% 0 - 1 /dev/vg00/lvol2

dev 8192 0 8192 0% 0 - 1 /dev/vgswap/lvswap2

reserve - 1301 -1301

memory 3876 963 2913 25%

total 20260 2264 17996 11% - 0 -

Step 2: Remove primary swap on-line

# swapoff /dev/vg00/lvol2

# lvrmboot -s vg00

# swapinfo -tm

Mb Mb Mb PCT START/ Mb

TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME

dev 8192 0 8192 0% 0 - 1 /dev/vgswap/lvswap2

reserve - 1291 -1291

memory 3876 963 2913 25%

total 12068 2254 9814 19% - 0 -

Step 3: Add line into /etc/fstab for the new primary swap and reboot the server

/dev/vg00/lvol3 / vxfs delaylog 0 1

/dev/vg00/lvol1 /stand vxfs tranflush 0 1

/dev/vg00/lvol4 /home vxfs delaylog 0 2

/dev/vg00/lvol5 /tmp vxfs delaylog 0 2

/dev/vg00/lvol6 /usr vxfs delaylog 0 2

/dev/vg00/lvol7 /var vxfs delaylog 0 2

/dev/vg00/lvol8 /var/tmp vxfs delaylog 0 2

#/dev/vg00/lvdump3 / dump defaults 0 0

/dev/vgswap/lvswap2 / swap defaults 0 0

After the reboot, check swap status and confirm that non-root volume is now the primary swap:

# swapinfo -tm

Mb Mb Mb PCT START/ Mb

TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME

dev 8192 0 8192 0% 0 - 1 /dev/vgswap/lvswap2

reserve - 1283 -1283

memory 3876 950 2926 25%

total 12068 2233 9835 19% - 0 -

However, because we did not initialize the disk in vgswap with “-B” option, it does not contain the Boot Area, and cannot be added with “lvlnboot -s /dev/vgswap/lvswap2”. As a result, this is reported:

# lvlnboot -v

Boot Definitions for Volume Group /dev/vg00:

Physical Volumes belonging in Root Volume Group:

/dev/disk/disk6_p2 -- Boot Disk

Boot: lvol1 on: /dev/disk/disk6_p2

Root: lvol3 on: /dev/disk/disk6_p2

No Swap Logical Volume configured

No Dump Logical Volume configured