Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed Solaris 10 05/09 on a machine and I used whatever the default swap space setting when I built the box. Now I need to increase the swap space and I can't add a swap file, like was possible under UFS. How can I increase the amount of swap on my ZFS drive?

share|improve this question
up vote 11 down vote accepted

If your swap device is in use, then you might not be able to delete it. Check to see if the swap area is in use. For example:

$ swap -l
swapfile                 dev    swaplo   blocks     free
/dev/zvol/dsk/rpool/swap 182,2         8  4194296  4194296

In the above output, blocks == free, so the swap device is not actually being used.

If the swap area is not is use, remove the swap area. For example:

$ swap -d /dev/zvol/dsk/rpool/swap

Confirm that the swap area is removed.

$ swap -l
No swap devices configured

Resize the swap volume. For example:

$ zfs set volsize=1G rpool/swap

One also has to ensure that the referenced swap is reserved from the pool, otherwise when it comes time to swap there might not be enough memory:

$ zfs set refreservation=1G rpool/swap

Activate the swap area.

$ swap -a /dev/zvol/dsk/rpool/swap

$ swap -l
swapfile                 dev    swaplo   blocks     free
/dev/zvol/dsk/rpool/swap 182,2         8  2097144  2097144

More info at: ZFS Troubleshooting Guide

share|improve this answer
So refreservation makes sure the normal files doesn't take up the SWAP? – CMCDragonkai Jul 4 '14 at 6:55
@CMCDragonkai: yes, refreservation ensures that rpool/swap will be allocated space from the pool even if it is unused. – easyE Dec 9 '14 at 10:43

If your swap is active, you can add an additional swap volume.

zfs create -V 10G rpool/swap2

swap -a /dev/zvol/dsk/rpool/swap2

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.