How To Add Swap File in Solaris:
Follow below example to add Swap in solaris:
STEP 1:
Create a 2gb swap file
#mkfile 2048M /swapfile
STEP2:
Now run following command to append this Swap File to existing Swap Space:
#swap -a /swapfile
STEP3:
Make entry in vfstab file to make it permanent (i.e. it will not remain after reboot)as below:
NOTE: vfstab is very critical file, so touch this file only when your are a solaris administrator.
Take backup of this file as below:
#cp /etc/vfstab /etc/vfstab.date
Now make changes in this file as below:
#vi /etc/vfstab
/dev/md/dsk/d31 – – swap – no –
/swapfile – – swap – no –
/swapfile – – swap – no –
STEP 4:
Run below commands before and after adding the swap space to crosscheck the activity:
swap -l
swap -s
df -h