Today, I was installing the Oracle Database 11g R2 on a Solaris system, but it failed a prerequisite check during the installation – it did not have enough swap space available. This particular system I had installed with ZFS. Turns out that adding extra swap space on a ZFS system is slightly different than what you might be used to. I am sure I am going to want to do this again some time, and I guess other folks will too, so here are the details.
Firstly, check where your swap file is (it will be a ZFS volume created during the Solaris installation):
bash-3.00# swap -l swapfile dev swaplo blocks free /dev/zvol/dsk/rpool/swap 256,1 16 4194288 4194288
Then you will need to unmount it:
bash-3.00# swap -d /dev/zvol/dsk/rpool/swap
You should validate it is unmounted:
bash-3.00# swap -l No swap devices configured
Then you can resize the ZFS volume (just give it the pool name and the volume name):
bash-3.00# zfs set volsize=16G rpool/swap
And then add it back into your swap space:
bash-3.00# swap -a /dev/zvol/dsk/rpool/swap
And now we see the swap space is back online and larger than before:
bash-3.00# swap -l swapfile dev swaplo blocks free /dev/zvol/dsk/rpool/swap 256,1 16 33554416 33554416
Pretty easy once you know how!