Adjusting the Sizes of ZFS Swap and Dump Devices

After installation, you might need to adjust the size of swap and dump devices after installation. Or you might need to recreate the swap and dump volumes.

By default, when you specify n blocks for the swap size, if the device is not a ZFS volume, the first page of the swap file is automatically skipped. Thus, the actual size that is assigned is n-1 blocks. To configure the swap file size differently, use the swaplow option with the swap command. For more information about the options for the swap command, see the swap(8) man page.

The following examples show how to adjust existing swap and dump devices under different circumstances.

Example 6-10 Resetting the Dump Device volsize Property

Note that resizing a large dump device can be a time-consuming process.

$ zfs set volsize=2G rpool/dump
$ zfs get volsize rpool/dump
NAME        PROPERTY  VALUE       SOURCE
rpool/dump  volsize   2G          -

Example 6-11 Resizing the Swap Volume for Immediate Use

This example shows how to adjust the size of the swap volume.

$ swap -l
swapfile                     dev    swaplo   blocks     free  encrypted
/dev/zvol/dsk/rpool/swap   230,5         0  2097152  2097152        yes
$ zfs get volsize rpool/swap
NAME         PROPERTY   VALUE    SOURCE
rpool/swap   volsize       1G     local
$ zfs set volsize=2g rpool/swap
$ swap -l
swapfile                     dev    swaplo   blocks     free  encrypted
/dev/zvol/dsk/rpool/swap   230,5         0  2097152  2097152        yes
/dev/zvol/dsk/rpool/swap   230,5   2097152  2097152  2097152        yes

You will see two swap entries temporarily, but you will have access to the extended swap space.