Troubleshooting ZFS Swap and Dump devices

During an initial installation or a Live Upgrade migration, a swap volume and dump volume are created. The default sizes of the swap and dump volumes that are created by the Solaris installation program are as follows:

  • swap volume size — Systems with 4 GB-128 GB memory, swap volume size is calculated in the 1-4 GB range.
  • dump volume size — Generally calculated as 1/2 of total memory size. A busy system with many active ZFS file systems might use 1/2 to 3/4 the size of physical memory for the size of the dump device.

You can adjust the sizes of your swap and dump volumes in a JumpStart profile or during an initial installation to sizes of your choosing as long as the new sizes support system operation.

# zfs list
NAME               USED  AVAIL  REFER  MOUNTPOINT
rpool             5.66G  27.6G  21.5K  /rpool   
rpool/ROOT        4.65G  27.6G    18K  /rpool/root
rpool/ROOT/zfsBE  4.65G  27.6G  4.65G  /
rpool/dump         515M  27.6G   515M  -
rpool/swap         513M  28.1G    16K  -

Resizing ZFS Swap and Dump Devices

  • You can adjust the size of your swap and dump volumes during an initial installation.
  • You can create and size your swap and dump volumes before you do a Solaris Live Upgrade operation. ZFS dump volume performance is better when the volume is created with a 128-KB block size. In SXCE, build 102, ZFS dump volumes are automatically created with a 128-KB block size (CR 6725698). For example:
    # zpool create rpool mirror c0t0d0s0 c0t1d0s0
    The Solaris 10 10/08 dump creation syntax would be:
    # zfs create -V 2G -b 128k rpool/dump
    The SXCE build 102 dump creation syntax would be:
    # zfs create -V 2G rpool/dump
    SPARC
    # zfs create -V 2G -b 8k rpool/swap
    x86
    # zfs create -V 2G -b 4k rpool/swap
  • Activate your swap device (if necessary):
    # swap -a /dev/zvol/dsk/zpool/swap
  • Add the swap entry to /etc/vfstab (If necessary):
    /dev/zvol/dsk/zpool/swap    -    -    swap    -    no
  • Actvate your dump device (if necessary)
    # dumpadm -d /dev/zvol/dsk/rpool/dump
  • Solaris Live Upgrade does not resize existing swap and dump volumes. You can reset the volsize property of the swap and dump devices after a system is installed. For example:
    # zfs set volsize=2G rpool/dump
    # zfs get volsize rpool/dump
    NAME        PROPERTY  VALUE      SOURCE
    rpool/dump  volsize   2G         -
  • You can adjust the size of the swap and dump volumes in a JumpStart profile by using profile syntax similar to the following:
    install_type initial_install
    cluster SUNWCXall
    pool rpool 16g 2g 2g c0t0d0s0
    In this profile, the 2g and 2g entries set the size of the swap area and dump device as 2 GB
  • You can adjust the size of your dump volume, but it might take some time, depending on the size of the dump volume. For example:
    # zfs set volsize=2G rpool/dump
    # zfs get volsize rpool/dump
    NAME        PROPERTY  VALUE      SOURCE
    rpool/dump  volsize   2G         -

Adjusting the Size of the Swap Volume on an Active System

If you need to adjust the size of the swap volume after installation on an active system, review the following steps. See CR 6765386 for more information.

  1. If your swap device is in use, then you might not be able to delete it. Check to see if the swap area is in use. For example:
    # swap -l
    swapfile                 dev    swaplo   blocks    free
    /dev/zvol/dsk/rpool/swap 182,2      8    4194296  4194296
    In the above output, blocks == free, so the swap device is not actually being used.
  2. If the swap area is not is use, remove the swap area. For example:
    # swap -d /dev/zvol/dsk/rpool/swap
  3. Confirm that the swap area is removed.
    # swap -l
    No swap devices configured
  4. Resize the swap volume. For example:
    # zfs set volsize=1G rpool/swap
  5. Activate the swap area.
    # swap -a /dev/zvol/dsk/rpool/swap
    # swap -l
    swapfile                 dev    swaplo  blocks    free
    /dev/zvol/dsk/rpool/swap 182,2      8   2097136  2097136
    The swap -a attempt might fail if the swap area is already listed in /etc/vfstab or is in use by Live Upgrade. In this case, use the swapadd feature instead.
    # /sbin/swapadd
    # swap -l
    swapfile                 dev    swaplo  blocks    free
    /dev/zvol/dsk/rpool/swap 256,1      16  2097136  2097136

If you need to add swap space but removing an existing swap device is difficult on a busy system, add another swap volume. For example:

# zfs create -V 2G rpool/swap1
# swap -a /dev/zvol/dsk/rpool/swap1
# swap -l
swapfile                  dev    swaplo  blocks    free
/dev/zvol/dsk/rpool/swap  256,1  16      2097136  2097136
/dev/zvol/dsk/rpool/swap1 256,5  16      4194288  4194288

Destroying an Inactive Root Pool With an Active Dump/Swap Device

If you want to destroy a ZFS root pool that is no longer needed, but it still has an active dump device and swap area, consider the following:

  • Boot from alternate media, import the inactive pool and destroy it
  • Or, use the swap command to create a second swap volume for the new root pool and use the dumpadm to reset the dump device to the new pool. After the previous dump and swap devices are no longer in use, you can remove them.
    # zfs create -V 2G rpool2/swap
    # swap -a /dev/zvol/dsk/rpool2/swap
    # zfs create -V 2G rpool2/dump
    # dumpadm -d /dev/zvol/dsk/rpool2/dump
  • NOTE: CR 6910925 prevents you from removing an existing dump device.

References

Retrieved from ZFS Troubleshooting Guide