Adding Swap File in Solaris

How To Add Swap File in Solaris:


Follow below  example to add Swap in solaris:


Create a 2gb swap file

#mkfile 2048M /swapfile


Now run following command to append this Swap File to existing Swap Space:

 #swap -a /swapfile


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/

Now  make changes in this file as below:

#vi /etc/vfstab
/dev/md/dsk/d31       –       –       swap    –       no      –
/swapfile             –       –       swap    –       no      –




Run below commands before and after adding the swap space to crosscheck the activity:

swap -l
swap -s
df -h


You can skip to the end and leave a response. Pinging is currently not allowed.

Leave a Reply