Become superuser.
You can create a swap file without root permissions, but it is a good idea for root to be the owner of the swap file to avoid accidental overwriting.
# mkfile nnn[k|b|m] filename |
The swap file of the size nnn (in Kbytes, bytes, or Mbytes) and name you specify is created.
Activate the swap file.
# /usr/sbin/swap -a /path/filename |
You must use the absolute path name to specify the swap file. The swap file is added and available until the file system is unmounted or the system is rebooted.
Add an entry for the swap file to the /etc/vfstab file that specifies the full path name of the file, and designates swap as the file system type, like this:
/path/filename - - swap - no - |
Verify that the swap file is added.
/usr/sbin/swap -l |
The following examples shows how to create a 24 Mbyte swap file called /files/swapfiles.
# mkdir /files # mkfile 24m /files/swapfile # swap -a /files/swapfile # vi /etc/vfstab (An entry is added for the swap file): /files/swapfile - - swap - no - # swap -l swapfile dev swaplo blocks free /dev/dsk/c0t2d0s1 32,17 8 205624 192704 /files/swapfile - 8 40952 40952 |