Adding or Changing Swap Space in an Oracle Solaris ZFS Root Environment

por | 30 diciembre, 2016

Adding or Changing Swap Space in an Oracle Solaris ZFS Root Environment

The following section describes how to add or change swap space in a ZFS root environment. See the previous sections to determine if your system or applications need additional swap space.

How to Add Swap Space in an Oracle Solaris ZFS Root Environment

  1. Become an administrator.For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris Administration: Security Services.
  2. Identify the current swap volume.A swap volume cannot be removed if it is in use. You can tell if the current swap volume is in use by comparing the blocks identified in the blocks column and blocks identified in the free column. If the blocks in the two columns are equal, the swap area is not busy. For example:
    # swap -l
    swapfile                 dev  swaplo   blocks   free
    /dev/zvol/dsk/rpool/swap 256,1      16 1058800 1058800
  3. Select one of the following to resize the swap volume.
    1. If the current swap area is not in use, you can resize the size of the current swap volume.For example:
      # zfs get volsize rpool/swap
      NAME        PROPERTY  VALUE    SOURCE
      rpool/swap  volsize   517M     -
      # zfs set volsize=2g rpool/swap
      # zfs get volsize rpool/swap
      NAME        PROPERTY  VALUE    SOURCE
      rpool/swap  volsize   2G       -
    2. If the current swap area is in use, you can add another swap volume.For example:
      # zfs create -V 2G rpool/swap2
    3. Activate the second 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