How do I add extra ZFS swap in Solaris 11.3?

solaris, solaris 11, solaris 11.3, swap, zfs

Thread Tools Search this Thread
# 1  
Old 1 Week Ago
How do I add extra ZFS swap in Solaris 11.3?


I have given 3 x 1 TB LUNs to add more swap space in a Solaris 11.3 OS

-bash-4.4# swap -l
swapfile                 dev            swaplo      blocks        free
/dev/zvol/dsk/rpool/swap 303,1              16     8388592     8388592
-bash-4.4# swap -s
total: 84780376k bytes allocated + 157031888k reserved = 241812264k used, 1495043920k available
-bash-4.4# zfs list | grep rpool/swap
rpool/swap                                           4.13G  33.1G  4.00G  -

Adding or Changing Swap Space in an Oracle Solaris ZFS Root Environment - Oracle Solaris 11.1 Administration: Devices and File Systems
Above Oracle Document states that you can expand your swap from rpool. However, there is not enough space in my rpool to do it.

Please your assistance as this is urgent matter.
# 2  
Old 1 Week Ago
Altho by default, solaris will create zvol under rpool for swap, one can use regular disk for it, a file or a zvol (3 options) from anywhere available.

Since your requirement is to have 3x1 TB of swap (??), i would go with disk backed devices.
Create a slice a on each disk, starting from 1st sector (not zero).
Add a swap device to configuration using swap -a <yourdisk><slice_number>
Modify the /etc/vfstab to have it after reboot.

Now you will have both ZVOL and new added disk listed under swap -l.
Remove the zvol via swap -d, the entry from /etc/vfstab, and using zfs command destroy the zvol.
The last operation might fail if swap is used (or has been used in past), then reboot will be required to remove it.

Question for you is, 3 TB of swap seems unreasonably high, why do you have requirement for such large swap space ?
Also, using fibre luns as swap could lead to terrible things to your infrastructure and storage, if you start using all that space...
How much memory do you have on that box ?

Hope that helps
This User Gave Thanks to Peasant For This Post:
feroccimx (1 Week Ago)
# 3  
Old 1 Week Ago
Hello Peasant,

Thank you for your troubleshoot.

System has 2 TB physical memory and several zones are being build on it. The 3 TB swap comes from a recommendation to have 1.5 times RAM. This gave relief to our system which experienced severe performance issues.

This is what I did in my undertanding:

zpool create -m none extra c0t6d0 c0t6d1 c0t6d2
zfs create -p -V 2900G extra/swap2
zfs set primarycache=metadata extra/swap2
swap -a /dev/zvol/dsk/extra/swap2
swap -l

# 4  
Old 1 Week Ago
Hi Feroccimx,

I would say that if you have a system with 2Tb of memory and have experienced performance issues, it is much more likely to be an application or configuration issue. A 3Tb swap area is inordinately large and as ZFS will use large portions of local memory for paging and swapping, moving significant ammounts of that to disk will impact performance of the SAN in a significant way.

I think that there is a need for some serious analysis work.


# 5  
Old 1 Week Ago
Huh, please point me where have you read that you need 1.5 X swap space, with 2 TB ram ?
I see no reason to have more then 1/4, which is more then enough.

What are you running in those zones ?

# 6  
Old 1 Week Ago
Originally Posted by feroccimx
The 3 TB swap comes from a recommendation to have 1.5 times RAM. This gave relief to our system which experienced severe performance issues.
Were they performance issues (like thrashing) or reliability issues (like coredumps)?

In general, increasing the swap area size is not expected to significantly improve performance (although in your case, the swap area is very undersized), but it can prevent programs to crash or to fail to start.

According to the statistics you wrote on the first post, there is 1.7T of virtual memory on your system with a tiny 4G being backed by your existing swap area.

The system is using 240 G of this virtual memory, two third of which being only reserved. You need at least 150 G of swap not to waste RAM (reserved size).

The actual swap size requirement depends on what precisely is running on your machine and each application way to use memory, but also about your dumpadm configuration. In case of a kernel panic, you might want to save the crashdump for further analysis and then a large swap area, like between 1/4 to 3/4 of the RAM size would make sense.

In any case, as long as the file systems also have enough free space, too large a swap doesn't hurt performance. There is a common misconception that a large swap will induce pagination. It doesn't make sense. What triggers pagination is RAM shortage, not swap availability.
This User Gave Thanks to jlliagre For This Post:
jim mcnamara (1 Week Ago)

Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Install Solaris 11 with ZFS mzainal Solaris 17 12-09-2014 02:59 AM
Swap Solaris 5.10 Michael.McGraw Solaris 18 07-02-2014 03:36 PM
To Add extra commas to a CSV file. chillblue UNIX for Dummies Questions & Answers 12 07-05-2012 09:18 AM
dual boot solaris/solaris zfs file system estammis Solaris 3 11-28-2011 10:05 AM
Add extra columns help saggiboy10 UNIX for Dummies Questions & Answers 9 10-11-2011 02:03 PM
increase SWAP on ZFS file system osmanux Solaris 4 10-05-2011 09:05 AM
Solaris zone on ZFS brusell Solaris 2 04-22-2011 05:36 AM
Solaris 10 SWAP SPACE cyberdemon Solaris 2 04-23-2010 04:09 AM
Solaris 10 ZFS ACL help Shoeless_Mike Solaris 1 11-16-2009 04:52 PM
Solaris 10 - Memory / Swap sbk1972 Solaris 1 10-16-2009 07:12 AM
How can I create a new swap location in ZFS? sqa777 Solaris 4 01-17-2009 05:32 AM
How to add and extra hour to the start time lalitka Linux 8 10-17-2008 06:52 PM
manipulating csv to add extra row neil546 Shell Programming and Scripting 3 07-16-2007 08:11 AM
Solaris 10 ZFS BG_JrAdmin Solaris 3 11-17-2005 08:33 AM