Adding more swap space to Omnios

I was building illumos-omnios in a new machine, but I found the following running omni mm

==== Build errors (DEBUG) ====

../port/print/wprintf.c:211:1: fatal error: error writing to /tmp/nightly.tmpdir.23929/ccIMaW7c.s: No space left on device
dmake: Warning: Command failed for target `pics/wprintf.o'
dmake: Warning: Target `libc_hwcap1.so.1' not remade because of errors
The following command caused the error:
dmake: Warning: Target `install' not remade because of errors
dmake: Warning: Command failed for target `libc'
collect2: error: ld returned 1 exit status

I checked my disk space and found out my tmp which uses /swap space with only 1gb reserved, the minimum to build illumos-omnios is 2gb.

neirac@bloody:/build$ df -ha
Filesystem             Size   Used  Available Capacity  Mounted on
rpool/ROOT/omnios-r151049
                     77.02G  3.03G     49.28G     6%    /
/devices                  0      0          0     0%    /devices
/dev                      0      0          0     0%    /dev
ctfs                      0      0          0     0%    /system/contract
proc                      0      0          0     0%    /proc
mnttab                    0      0          0     0%    /etc/mnttab
swap                 995.44M   288K    995.16M     1%    /etc/svc/volatile
objfs                     0      0          0     0%    /system/object
bootfs                    0      0          0     0%    /system/boot
sharefs                   0      0          0     0%    /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
                     52.31G  3.03G     49.28G     6%    /lib/libc.so.1
fd                        0      0          0     0%    /dev/fd
swap                 995.23M    80K    995.16M     1%    /tmp
swap                 995.19M    32K    995.16M     1%    /var/run
rpool/home           77.02G    24K     49.28G     1%    /home
rpool                77.02G    25K     49.28G     1%    /rpool
rpool/home/neirac    77.02G 829.62M     49.28G     2%    /home/neirac
rpool/build          77.02G  3.03G     49.28G     6%    /build
bhyverpool            7.27G   204K      6.50G     1%    /HVMbhyverpool/bhyverpool
bhyverpool/ROOT/omnios-r151049
                      7.27G 773.63M      6.50G    11%    /HVMbhyveroot
rpool/kayak_image    77.02G 173.79M     49.28G     1%    /kayak_image
rpool/kayak_image/miniroot
                     77.02G 151.73M     49.28G     1%    /kayak_image/miniroot

As we are using ZFS is really easy to increase swap space

neirac@bloody:/build$ swap -l
swapfile             dev    swaplo   blocks     free
/dev/zvol/dsk/rpool/swap 267,2         8  2097144  1866152
neirac@bloody:/build$ zfs get volsize rpool/swap
NAME        PROPERTY  VALUE    SOURCE
rpool/swap  volsize   1G       local
neirac@bloody:/build$ sudo zfs set volsize=2g rpool/swap
neirac@bloody:/build$ zfs get volsize rpool/swap
NAME        PROPERTY  VALUE    SOURCE
rpool/swap  volsize   2G       local
neirac@bloody:/build$

I don't want to reboot so I'll increase swap space on the fly

neirac@bloody:/build$ sudo zfs create -V 4G rpool/swap2
neirac@bloody:/build$ sudo swap -a /dev/zvol/dsk/rpool/swap2
neirac@bloody:/build$ sudo swap -l
swapfile             dev    swaplo   blocks     free
/dev/zvol/dsk/rpool/swap 267,2         8  2097144  1924224
/dev/zvol/dsk/rpool/swap2 267,7         8  8388600  8388600

That's all.

References