How to add swap space in Oracle Solaris ZFS


This KB describes how to add or change swap space in a ZFS root environment. Check previous sections to determine if your system needs more swap.

Step 1:Identify the current swap configurations.
 

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


Step 2:Get the current size of swap.
 

#zfs get volsize rpool/swap
NAME PROPERTY VALUE SOURCE
rpool/swap volsize 517M –


Step 3:How to set ZFS volume size or add new zfs swap volume?

-If the current swap area is not in use, you can resize the size of the current swap volume, but you must reboot server to activate change.
 

#zfs set volsize=2G rpool/swap

-If the system can not be rebooted, to increase your total swap you can apply this action plan;Also you need to update vfstab;
 

#zfs create -V 2G rpool/swap2
#swap -a /dev/zvol/dsk/rpool/swap2
#swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 256,1 16 1058800 1058800
/dev/zvol/dsk/rpool/swap2 256,3 16 4194288 4194288


-Add this line to /etc/vfstab;
 

/dev/zvol/dsk/rpool/swap2 – – swap – no –

I'm a IT Infrastructure and Operations Architect with extensive experience and administration skills and works for Turk Telekom. I provide hardware and software support for the IT Infrastructure and Operations tasks.

205 Total Posts
Follow Me