Pages

Wednesday, February 13, 2013

Resize ZFS Swap

To resize your ZFS based Swap you need to know on which pool your Swap resides:

# zfs list
NAME                        USED  AVAIL  REFER  MOUNTPOINT
rpool                      9,70G  5,92G  32,5K  /rpool
rpool/ROOT                 8,42G  5,92G    21K  legacy
rpool/ROOT/s10x_u9wos_14a  8,42G  5,92G  8,42G  /
rpool/dump                  768M  5,92G   768M  -
rpool/export                763K  5,92G    23K  /export
rpool/export/home           740K  5,92G   740K  /export/home
rpool/swap                  544M  5,95G   516M  -


The easy way:

# zfs list | grep swap
rpool/swap                  544M  5,95G   516M  -


In this case the Swap lays on the ZFS pool rpool. Next get the current Swap size:

# zfs get volsize rpool/swap
NAME        PROPERTY  VALUE    SOURCE
rpool/swap  volsize   512M     local


The ouptu above shows that Swap area has a size of 512MB. To resize the Swap area to 2GB use:

# zfs set volsize=2048M rpool/swap

And check again:

# zfs get volsize rpool/swap
NAME        PROPERTY  VALUE    SOURCE
rpool/swap  volsize   2G       local


The Swap area has been changed from 512MB to 2GB.