Increasing swap size on Solaris (using ZFS)

Today, I was installing the Oracle Database 11g R2 on a Solaris system, but it failed a prerequisite check during the installation – it did not have enough swap space available.  This particular system I had installed with ZFS.  Turns out that adding extra swap space on a ZFS system is slightly different than what you might be used to.  I am sure I am going to want to do this again some time, and I guess other folks will too, so here are the details.

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

Pretty easy once you know how!

About Mark Nelson

Mark Nelson is an Architect ("IC6") in the Platform Architecture Team in Oracle Development. Mark's focus area is continuous delivery, configuration management and provisioning - making it simple to manage the configuration of complex environments and applications built with Oracle Database, Fusion Middleware and Fusion Applications, on-premise and in the cloud. Before joining the Platform Architecture team, Mark was a senior member of the A-Team since 2010, and worked in Sales Consulting at Oracle since 2006 and various roles at IBM since 1994.
This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

One Response to Increasing swap size on Solaris (using ZFS)

  1. Pingback: [How To] Increase size swap space ZFS – Solaris 11

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s