Eelco Life, UNIX, and everything – Now in English

Manipulating swap space with ZFS

Let's assume your OpenSolaris workstation doesn't have enough swap space configured. In the old pre-ZFS days this was solvable by creating a swapfile using mkfile(1M). In ZFS things are a bit different, the resulting files aren't usable as swap space anymore.

Check the available amount of swap space using "zfs get":

root@dorfl:~# zfs get volsize rpool/swap
NAME        PROPERTY  VALUE    SOURCE
rpool/swap  volsize   1G       -

In my case, I have 1GB availebla swap space, I would like this to be a bit more.  I can do this using "zfs set":

root@dorfl:~# zfs set volsize=4G rpool/swap
(no output)

Double check the outcome with "zfs get":

root@dorfl:~# zfs get volsize rpool/swap
NAME        PROPERTY  VALUE    SOURCE
rpool/swap  volsize   4G       -

Happy swapping ;-)