# increase SWAP on ZFS file system

**URL:** <https://community.unix.com/t/increase-swap-on-zfs-file-system/296557>\
**Category:** Solaris\
**Created:** [October 4, 2011, 6:46am UTC](https://community.unix.com/t/increase-swap-on-zfs-file-system/296557 "2011-10-04T06:46:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![osmanux](https://community.unix.com/letter_avatar/osmanux/32/6_449c533f586939b6e5f246632a46421f.png) [@osmanux](https://community.unix.com/u/osmanux)\
**Post date:** [October 4, 2011, 6:46am UTC](https://community.unix.com/t/increase-swap-on-zfs-file-system/296557/1 "2011-10-04T06:46:41Z")

</div>

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

```nohighlight
 # 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

```

---

<div class="post-metadata">

**Author:** ![h112](https://community.unix.com/letter_avatar/h112/32/6_449c533f586939b6e5f246632a46421f.png) [@h112](https://community.unix.com/u/h112)\
**Post date:** [October 4, 2011, 7:41am UTC](https://community.unix.com/t/increase-swap-on-zfs-file-system/296557/2 "2011-10-04T07:41:22Z")

</div>

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

```nohighlight
#echo "/dev/zvol/dsk/rpool/swap - - swap - no -" >> /etc/vfstab

```

```nohighlight
#/usr/sbin/swap -a /dev/zvol/dsk/rpool/swap

```

---

<div class="post-metadata">

**Author:** ![osmanux](https://community.unix.com/letter_avatar/osmanux/32/6_449c533f586939b6e5f246632a46421f.png) [@osmanux](https://community.unix.com/u/osmanux)\
**Post date:** [October 4, 2011, 8:30am UTC](https://community.unix.com/t/increase-swap-on-zfs-file-system/296557/3 "2011-10-04T08:30:31Z")

</div>

i tried this 2 command and i got this result

```nohighlight
-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

```nohighlight
-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 "

---

<div class="post-metadata">

**Author:** ![h112](https://community.unix.com/letter_avatar/h112/32/6_449c533f586939b6e5f246632a46421f.png) [@h112](https://community.unix.com/u/h112)\
**Post date:** [October 4, 2011, 3:46pm UTC](https://community.unix.com/t/increase-swap-on-zfs-file-system/296557/4 "2011-10-04T15:46:58Z")

</div>

> [@osmanux](#):
>
> i tried this 2 command and i got this result
> 
> ```plaintext
> 
> -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.

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

```

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

```plaintext
# swap -l

```

3- Re add the swap sapce again.

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

```

---

<div class="post-metadata">

**Author:** ![vivek.goel.piet](https://community.unix.com/user_avatar/community.unix.com/vivek.goel.piet/32/7192_2.png) [@vivek.goel.piet](https://community.unix.com/u/vivek.goel.piet)\
**Post date:** [October 5, 2011, 8:05am UTC](https://community.unix.com/t/increase-swap-on-zfs-file-system/296557/5 "2011-10-05T08:05:50Z")

</div>

try this code

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

```
