How do I add extra ZFS swap in Solaris 11.3?

Login or Register to Reply

Thread Tools Search this Thread
# 1  
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  
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:
# 3  
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  
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  
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  
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:
Login or Register to Reply

Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
dual boot solaris/solaris zfs file system
Hi, I am running into a some problems creating a dual boot system of 2 solaris instances using ZFS file system and I was wondering if someone can help me out. First some back ground. I have been asked to change the file system of our server from UFS to ZFS. Currently we are using Solaris...... Solaris
Add extra columns help
Hi Gurus, This below script adds a column extra to my flat file..But how can i add another column, Say if i just put mention an other column beside the first does get generated but as one column only while IFS="" read r; do printf "dummy\t%s\n" "$r" done < xxx.txt > zzz.txt ...... UNIX for Dummies Questions & Answers
UNIX for Dummies Questions & Answers
increase SWAP on ZFS file system
Hi All, I am using this commands to dynamically increase ZFS swap space on Solaris my question is: 1- after i make these commands it will permanent or it will remove after restart 2- how to make it permanent # swap -l swapfile dev swaplo bloques libre /dev/zvol/dsk/rpool/swap...... Solaris
How can I create a new swap location in ZFS?
I am running OpenSolaris v5.11 During installation, the installation created default ZFS filesystems, like the dump and swap locations. I want to change the blocksize of the /dump and /swap locations and make them ZFS volumes. The ZFS system is on a zpool called rpool I was able to do...... Solaris