Resizing Solaris swap partition online
A quick and simple trick to resize a Solaris swap partition online.
In this example we will increase the swap partition from 2G to 5G (note our swap partition is under zfs control)
- Determine current swap
# swap -lh swapfile dev swaplo blocks free /dev/zvol/dsk/rpool/swap 124,2 4K 2.0G 2.0G
- Remove the current swap file:
# swap -d /dev/zvol/disk/rpool/swap
- Increase the size of swap space
# zfs set volsize=5G rpool/swap
- Finally, re-add the swap space:
# swap -a /dev/zol/dsk/rpool/swap