How to Create a Swap Volume

This procedure applies to both root pools and non-root pools. If you need more swap space but the existing pool is not large enough, just add another swap volume by using this same procedure. The procedure adds the swap volume permanently such that the swap volume is added on each boot.

  1. Create a ZFS volume to use as swap.
    $ zfs create -V size new-pool/swap
  2. Activate the new swap volume.
    $ swap -a new-pool/swap
  3. If necessary, reboot the system.

Example 6-7 Manually Creating a Swap Volume

This example creates a new 4 GB swap volume in the rpool2 pool. This new swap volume is intended to replace an existing swap volume.

$ zfs create -V 4g rpool2/swap2
$ swap -a rpool2/swap2