Example:
How to Add More Swap Space without Repartitioning the Disk
To add more swap space, perform the following steps:
Become superuser.
Create a directory for the swap file, if needed-for example:
mkdir /moreswap
Create the swap file by using the mkfile command, which has the following syntax:
mkfile <number> [k|b|m] <filename>
The <number> specifies the file size in KB, bytes, or MB specified by k, b, or m. For example, to create 500MB swap space, issue the following command:
mkfile 500m /moreswap/swapFile
Activate the swap file by carrying on the same example:
# /usr/sbin/swap -a /moreswap/swapFile
You must use the absolute path name to specify the swap file. The swap file is now added, and activated. It is available until the file system is unmounted, the system is rebooted, or the swap file is removed. The swap file will be automatically activated each time the system is booted, if you perform the next step.
Add the following entry for the swap file to the /etc/vfstab file, again using the running example:
/moreswap/swapFile - - swap - no -
Issue the following command to verify that the swap file has actually been added:
/usr/sbin/swap -l