Managing File Systems in Oracle® Solaris 11.2

Exit Print View

Updated: July 2014
 
 

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

  1. Become an administrator.

    For more information, see Using Your Assigned Administrative Rights in Securing Users and Processes in Oracle Solaris 11.2 .

  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, but you must reboot the system to see the increased swap space.

      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       -
      # init 6
    2. If the system cannot be rebooted, add another swap volume to increase your total swap space.

      For example:

      # zfs create -V 2G rpool/swap2

      Then, activate the second swap volume.

      # 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
  4. If necessary, add an entry for the second swap volume in the /etc/vfstab file.

    For example:

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