Managing ZFS File Systems in Oracle® Solaris 11.2

Exit Print View

Updated: December 2014

Adjusting the Sizes of Your ZFS Swap and Dump Devices

You might need to adjust the size of swap and dump devices after installation or possibly, recreate the swap and dump volumes.

  • You can reset the volsize property of the dump device after a system is installed. For example:

    # zfs set volsize=2G rpool/dump
    # zfs get volsize rpool/dump
    rpool/dump  volsize   2G          -
  • You can resize the swap volume for immediate use by the system. For example:

    # swap -l
    swapfile                     dev    swaplo    blocks     free
    /dev/zvol/dsk/rpool/swap   303,1         8   2097144  2097144
    # zfs get volsize rpool/swap
    rpool/swap   volsize       1G     local
    # zfs set volsize=2g rpool/swap
    # swap -l
    swapfile                     dev    swaplo   blocks     free
    /dev/zvol/dsk/rpool/swap   303,1         8  2097144  2097144
    /dev/zvol/dsk/rpool/swap   303,1   2097160  2097144  2097144

    Alternatively, you can use the following method to resize the swap volume. With this method, however, you must reboot the system to see the increased swap size.

    # swap -d /dev/zvol/dsk/rpool/swap
    # zfs set volsize=2G rpool/swap
    # swap -a /dev/zvol/dsk/rpool/swap
    # init 6

    Note - By default, when you specify n blocks for the swap size, 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(1M) man page.

    For information on removing a swap device on an active system, see How to Add Swap Space in an Oracle Solaris ZFS Root Environment in Managing File Systems in Oracle Solaris 11.2 .

  • If you need more swap space on a system that is already installed and the swap device is busy, just add another swap volume. For example:

    # zfs create -V 2G rpool/swap2
  • Activate the new swap volume. For example:

    # swap -a /dev/zvol/dsk/rpool/swap2
    # swap -l
    swapfile                  dev  swaplo   blocks   free
    /dev/zvol/dsk/rpool/swap  256,1      16 1058800 1058800
    /dev/zvol/dsk/rpool/swap2 256,3      16 4194288 4194288
  • Add an entry for the second swap volume to the /etc/vfstab file. For example:

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