Tag Archives: swap

How to Increase swap size on Solaris (using ZFS) solaris 11

Firstly, check where your swap file is (it will be a ZFS volume created during the Solaris installation):

bash-3.00# swap -l
swapfile             dev  swaplo blocks   free
/dev/zvol/dsk/rpool/swap 256,1      16 4194288 4194288

Then you will need to unmount it:

bash-3.00# swap -d /dev/zvol/dsk/rpool/swap

You should validate it is unmounted:

bash-3.00# swap -l
No swap devices configured

Then you can resize the ZFS volume (just give it the pool name and the volume name):

bash-3.00# zfs set volsize=16G rpool/swap

And then add it back into your swap space:

bash-3.00# swap -a /dev/zvol/dsk/rpool/swap

And now we see the swap space is back online and larger than before:

bash-3.00# swap -l
swapfile             dev  swaplo blocks   free
/dev/zvol/dsk/rpool/swap 256,1      16 33554416 33554416

Enjoy !!

Linux add a swap file

You need to use dd command to create swapfile. Next you need to use mkswap command to set up a Linux swap area on a device or in a file.


a) Login as the root user


b) Type following command to create 512MB swap file (1024 * 1024MB = 1048576 block size):
# dd if=/dev/zero of=/swapfile1 bs=1024 count=1048576


c) Set up a Linux swap area:
# mkswap /swapfile


d) Activate /swapfile1 swap space immediately:
# swapon /swapfile


e) To activate /swapfile1 after Linux system reboot, add entry to /etc/fstab file. Open this file using text editor such as vi:
# vi /etc/fstab


Append following line:
/swapfile swap swap defaults 0 0


So next time Linux comes up after reboot, it enables the new swap file for you automatically.


g) How do I verify swap is activated or not?
Simply use free command:
$ free -m