Swap space is a reserved area of a disk that the Oracle Solaris OS software and application software can use for temporary storage. Swap space is used as virtual memory storage areas when the system does not have enough physical memory to handle current processes that are running. In Oracle Solaris 10 a UFS root environment provides one disk slice for both swap and dump devices. In Oracle Solaris 11, two separate volumes are created as a swap device and a dump device. In a ZFS root file system, the disk space that is reserved for swap is a ZFS volume. Use the dumpadm command as follows to display this information:
# dumpadm Dump content: kernel pages Dump device: /dev/zvol/dsk/rpool/dump (dedicated) Savecore directory: /var/crash Savecore enabled: yes Save compressed: on
# swap -l swapfile dev swaplo blocks free /dev/zvol/dsk/rpool/swap 182,2 8 4061176 4061176
Display information about the swap and dump volume names and sizes as follows:
# zfs list -t volume -r rpool NAME USED AVAIL REFER MOUNTPOINT rpool/dump 4.13G 51.6G 4.00G - rpool/swap 4.13G 51.6G 4.00G -
You can display swap space sizes in human-readable format, as shown in the following example:
# swap -sh total: 1.4G allocated + 227M reserved = 1.6G used, 432G available # swap -lh swapfile dev swaplo blocks free /dev/zvol/dsk/rpool/swap 285,2 8K 4.0G 4.0G
Managing ZFS swap and dump volumes differs from how you manage a single slice for a UFS swap and dump device in the following ways:
You cannot use a single volume for both swap and dump devices in a ZFS root environment.
You cannot use a file as a swap device in a ZFS root environment.
The system requires that the dump device is approximately 1/2 to 3/4 the size of physical memory. If the dump device is too small, an error similar to the following is displayed:
# dumpadm -d /dev/zvol/dsk/rpool/dump dumpadm: dump device /dev/zvol/dsk/rpool/dump is too small to hold a system dump dump size 36255432704 bytes, device size 34359738368 bytes
You can easily increase the size of the dump device by increasing the volume's volsize property, as shown in the following example. Note that it might take some time to reinitialize the volume.
# zfs get volsize rpool/dump NAME PROPERTY VALUE SOURCE rpool/dump volsize 1.94G local # zfs set volsize=3g rpool/dump # zfs get volsize rpool/dump NAME PROPERTY VALUE SOURCE rpool/dump volsize 3G local
Changing the size of the swap volume is difficult if the swap device is in use. Consider creating a second swap volume and adding it as a swap device as follows:
# zfs create -V 3G rpool/swap2 # swap -a /dev/zvol/dsk/rpool/swap2 # swap -l swapfile dev swaplo blocks free /dev/zvol/dsk/rpool/swap 182,2 8 4061176 4061176 /dev/zvol/dsk/rpool/swap2 182,4 8 6291448 6291448
Then, add an entry for the new swap device in the /etc/vfstab file as follows:
/dev/zvol/dsk/rpool/swap2 - - swap - no -
For information about managing system crashes by using the deferred dump process, see System Configuration Changes. For information about file systems, see Managing File Systems in Oracle Solaris 11.3.