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 256,2 16 2097136 2097136
  # zfs set volsize=2G rpool/swap
  # env NOINUSE_CHECK=1 swap -a /dev/zvol/dsk/rpool/swap $((8+2097136))
  # swap -l
  swapfile dev swaplo bloques libre
  /dev/zvol/dsk/rpool/swap 256,2 16 2097136 2097136
  /dev/zvol/dsk/rpool/swap 256,2 2097152 2097152 2097152

You need to put an entry in /etc/vfstab file.

#echo "/dev/zvol/dsk/rpool/swap -  -  swap  -  no   -" >> /etc/vfstab
#/usr/sbin/swap -a /dev/zvol/dsk/rpool/swap
1 Like

i tried this 2 command and i got this result

-bash-3.00# echo "/dev/zvol/dsk/rpool/swap -  -  swap  -  no   -" >> /etc/vfstab
You have new mail in /usr/mail/root

this line as been add to /etc/vfstab

-bash-3.00# /usr/sbin/swap -a /dev/zvol/dsk/rpool/swap
/dev/zvol/dsk/rpool/swap is currently used by swap. Please see swap(1M).
-bash-3.00#

i think no need to make the second command because it is already done "is that correct or not "

You have a new mail due to the newer vfstab entry just read your email.

Yes you are right no need to issue the second command.
Otherwise issue the following commands again
1- Remove swap sapce.

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

2- Make sure that the swap sapce you have configured doesn't exist.

# swap -l

3- Re add the swap sapce again.

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

try this code

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