The purpose of this documentation is to quickly describe how to create swap space on Solaris. There are other documentation sources such as Disk Management in Solaris that describe in depth how disks work on Solaris, but that's not the goal here.
We'll look at three methods to add swap space:
On UFS
On ZFS
Using a swap file
Swap on UFS
If you want to add swap space on a UFS disk, you'll need to create a partition. Let's first see what we have:
We can see that the last cylinder is 7182 out of 53498. We'll continue after this cylinder. Let's take a random slice (slice 5 for example) and create a new swap partition on it:
Here I've created a partition starting from the last used cylinder (7182) + 1 (7183), a swap partition with the corresponding flag (wu), with a size of 70GB. Then I display the new partition table:
#device device mount FS fsck mount mount#to mount to fsck point type pass at boot options#fd-/dev/fdfd-no-
/proc-/procproc-no-
/dev/dsk/c1t0d0s1--swap-no-
/dev/dsk/c1t0d0s0/dev/rdsk/c1t0d0s0/ufs1no-
/dev/dsk/c1t0d0s3/dev/rdsk/c1t0d0s3/varufs1no-
/dev/dsk/c1t0d0s5--swap-no-
/dev/dsk/c1t0d0s7/dev/rdsk/c1t0d0s7/export/homeufs2yes-
#/dev/dsk/c1t0d0s4 /dev/rdsk/c1t0d0s4 /globaldevices ufs 2 yes -/devices-/devicesdevfs-no-
sharefs-/etc/dfs/sharetabsharefs-no-
ctfs-/system/contractctfs-no-
objfs-/system/objectobjfs-no-
swap-/tmptmpfs-yes-
/dev/did/dsk/d4s4/dev/did/rdsk/d4s4/global/.devices/node@2ufs2noglobal
Swap on ZFS
You simply need to increase the size of the ZFS associated with the swap.
When the machine is running and the swap space is being used, you can increase the size of the swap so that the system can use it. This will require deactivation and reactivation for the new space to be recognized. To do this, we'll enlarge the ZFS:
For a swap file, it's the quickest method to implement but also the least elegant. Find a place on your disk where you have space and create an empty file of the desired size: