Using a ZFS Volume as a Swap or Dump Device

During an installation of a ZFS root file system or a migration from a UFS root file system, a swap device and a dump device are created on a ZFS volume in the ZFS root pool. The following examples show how to display information about the swap device and the dump device.

$ swap -l
swapfile                     dev    swaplo   blocks     free
/dev/zvol/dsk/rpool/swap   253,3        16  8257520  8257520

$ dumpadm
Dump content: kernel pages
Dump device: /dev/zvol/dsk/rpool/dump (dedicated)
Savecore directory: /var/crash/
Savecore enabled: yes

If you need to change your swap area or dump device after the system is installed, use the swap and dumpadm commands as in previous Oracle Solaris releases. If you need to create an additional swap volume, create a ZFS volume of a specific size and then enable swap on that device. Then, add an entry for the new swap device in the /etc/vfstab file. For example:

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

Do not swap to a file on a ZFS file system. A ZFS swap file configuration is not supported.

For information about adjusting the size of the swap and dump volumes, see Adjusting the Sizes of ZFS Swap and Dump Devices.