Add Swap Space in Solaris

1. Login as a root, check the swap space devices and resources.

# swap -l
swapfile             dev   swaplo  blocks   free
/dev/dsk/cxdxtxsx    xx,x       x  xxxxxxx  xxxxxxx
# swap -s
total: xxxxxk bytes allocated + xxxxxk reserved = xxxxxk used, xxxxxk available

2. Use mkfile to create a swap file. For example, create 512MB size of swap space.

# mkfile 512m /usr/local/swap

3. Add the file created in the swap area.

# swap -a /usr/local/swap

4. Check the swap space again.

# swap -l
swapfile             dev   swaplo  blocks   free
/dev/dsk/cxdxdxsx   xx,x   x       xxxxxxx  xxxxxxx
/usr/local/swap        -   x       xxxxxxx  xxxxxxx

5. Above step is not a permanent add to the system. If a reboot occurred, the swap space will be remove automatically. To add the swap space permanently, you need to add the below lines into the /etc/vfstab.

/usr/local/swap   -   -   swap   -   no   -

You May Also Like

Leave a Reply?