Adding new ZFS disk to FreeBSD

Useful links:
https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot
https://vermaden.wordpress.com/2023/04/30/simple-freebsd-poudriere-harvester-guide

List physical disks:
# camcontrol devlist
at scbus0 target 0 lun 0 (pass0,ada0)
at scbus0 target 1 lun 0 (pass1,ada1)
at scbus1 target 0 lun 0 (pass2,ada2)

Create partition table:
# gpart destroy ada0
# gpart create -s gpt ada2
ada2 created

Create zfs partition:
# gpart add -a 1m -t freebsd-zfs -l poudriere ada2
ada2p1 added

Create pool:
# gpart show -p ada2
=> 40 125829040 ada2 GPT (60G)
40 2008 - free - (1.0M)
2048 125825024 ada2p1 freebsd-zfs (60G)
125827072 2008 - free - (1.0M)

# zpool create -o altroot=/usr/local/ poudriere ada2p1

https://www.unixtutorial.org/zfs-performance-basics-disable-atime/
Disabling atime for ZFS:
# zfs get all poudriere |grep time
poudriere atime on default
poudriere relatime off default

# zfs set atime=off poudriere
# zfs get all poudriere | grep time
poudriere atime off local
poudriere relatime off default

If not enabled:
sysrc zfs_enable="YES"
echo 'zfs_load="YES"' >> /boot/loader.conf

# zpool import poudriere
# zfs create -o mountpoint=/usr/local/poudriere poudriere/poudriere

reboot and check if the mountpoints are live

Rebuild a port on FreeBSD

To rebuild a port and ports which this port depends on:

portmaster -DRf origin/port
portupgrade -Rf origin/port

To rebuild a port and ports which depends on it:

portmaster -Drf origin/port
portupgrade -rf origin/port

To list packages with their dependencies

pkg query -g "%n:%dn" '*'

Then use script to rebuild required – example for openssl

sh
REBUILD=$(pkg query -g "%n:%dn" '*' | grep openssl | cut -d : -f 1 | sort -u)
portmaster -D $REBUILD

Problems installing mate-icon-theme on FreeBSD

[Update]
Try to rebuild mapping util

# pkg which /usr/local/libexec/icon-name-mapping
/usr/local/libexec/icon-name-mapping was installed by package icon-naming-utils-0.8.90_1            
# portmaster -D icon-naming-utils

Just in case mount yours ports tree on /usr/ports


# mount -t nullfs /usr/jails/ports /usr/ports

Build and install package


# make install
===>  Installing for mate-icon-theme-1.18.2
===>  Checking if mate-icon-theme already installed
===>   Registering installation for mate-icon-theme-1.18.2
pkg-static: Unable to access file /usr/ports/x11-themes/mate-icon-theme/work/stage/usr/local/share/icons/mate/16x16/actions/add.png:No such file or directory
pkg-static: Unable to access file /usr/ports/x11-themes/mate-icon-theme/work/stage/usr/local/share/icons/mate/16x16/actions/appointment.png:No such file or directory
pkg-static: Unable to access file /usr/ports/x11-themes/mate-icon-theme/work/stage/usr/local/share/icons/mate/16x16/actions/back.png:No such file or directory
pkg-static: Unable to access file /usr/ports/x11-themes/mate-icon-theme/work/stage/usr/local/share/icons/mate/16x16/actions/bookmark_add.png:No such file or directory
pkg-static: Unable to access file /usr/ports/x11-themes/mate-icon-theme/work/stage/usr/local/share/icons/mate/16x16/actions/bookmarks_list_add.png:No such file or directory
pkg-static: Unable to access file /usr/ports/x11-themes/mate-icon-theme/work/stage/usr/local/share/icons/mate/16x16/actions/bottom.png:No such file or directory
pkg-static: Unable to access file /usr/ports/x11-themes/mate-icon-theme/work/stage/usr/local/share/icons/mate/16x16/actions/centrejust.png:No such file or directory
pkg-static: Unable to access file /usr/ports/x11-themes/mate-icon-theme/work/stage/usr/local/share/icons/mate/16x16/actions/down.png:No such file or directory
pkg-static: Unable to access file /usr/ports/x11-themes/mate-icon-theme/work/stage/usr/local/share/icons/mate/16x16/actions/editclear.png:No such file or directory
pkg-static: Unable to access file /usr/ports/x11-themes/mate-icon-theme/work/stage/usr/local/share/icons/mate/16x16/actions/editcopy.png:No such file or directory

(snip)

pkg-static: Unable to access file /usr/ports/x11-themes/mate-icon-theme/work/stage/usr/local/share/icons/menta/48x48/status/gnome-netstatus-txrx.png:No such file or directory
pkg-static: Unable to access file /usr/ports/x11-themes/mate-icon-theme/work/stage/usr/local/share/icons/menta/48x48/status/nm-adhoc.png:No such file or directory
pkg-static: Unable to access file /usr/ports/x11-themes/mate-icon-theme/work/stage/usr/local/share/icons/menta/48x48/status/nm-device-wired.png:No such file or directory
pkg-static: Unable to access file /usr/ports/x11-themes/mate-icon-theme/work/stage/usr/local/share/icons/menta/48x48/status/nm-device-wireless.png:No such file or directory
pkg-static: Unable to access file /usr/ports/x11-themes/mate-icon-theme/work/stage/usr/local/share/icons/menta/48x48/status/nm-no-connection.png:No such file or directory
pkg-static: Unable to access file /usr/ports/x11-themes/mate-icon-theme/work/stage/usr/local/share/icons/menta/48x48/status/stock_open.png:No such file or directory
*** Error code 74

Stop.
make: stopped in /usr/ports/x11-themes/mate-icon-theme

Create text file with output and create not existing files then finally install package


# make install > & output.txt
# cat output.txt | grep Unable | awk '{print $6}' | cut -d ':' -f 1 | xargs touch

# make install
===>  Installing for mate-icon-theme-1.18.2
===>  Checking if mate-icon-theme already installed
===>   Registering installation for mate-icon-theme-1.18.2
Installing mate-icon-theme-1.18.2...

slow graid mirror rebuild

Setting kern.geom.raid.idle_threshold to lower value increases speed of rebuilding graid mirror and transfer on ada1 disk
https://www.freebsd.org/cgi/man.cgi?graid(8)

root@thirdeye:/usr/ports # sysctl kern.geom.raid.idle_threshold=1000000
kern.geom.raid.idle_threshold: 10000 -> 1000000
root@thirdeye:/usr/ports # iostat 1 -1
       tty            ada0             ada1             ada2             cpu
 tin  tout  KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id
   0     3 59.55  18  1.06  114.09   7  0.80   6.10   2  0.01   2  0  1  0 97
   0   533 86.86  14  1.18  128.00   8  0.99   0.00   0  0.00   0  0  0  0 100
   0   374 32.00   6  0.19   0.00   0  0.00   0.00   0  0.00   0  0  0  0 100
   0   194 32.00   6  0.19   0.00   0  0.00   0.00   0  0.00   0  0  0  0 100
   0   193 32.00   6  0.19   0.00   0  0.00   0.00   0  0.00   1  0  0  0 99
   0   190 80.00  16  1.23  128.00   8  0.99   0.00   0  0.00   1  0  1  0 99
   0   197 32.00   2  0.06   0.00   0  0.00   0.00   0  0.00   0  0  0  0 100
   0   188 32.00   4  0.12   0.00   0  0.00   0.00   0  0.00   0  0  0  0 100
   0   199 32.00   6  0.19   0.00   0  0.00   0.00   0  0.00   0  0  0  0 99
   0   194 96.00  12  1.14  128.00   8  1.01   0.00   0  0.00   3  0  0  0 97
   0   186 35.56   9  0.30   0.00   0  0.00   0.00   0  0.00   5  0  1  0 94
   0   195 108.80  20  2.16  128.00  16  2.03   0.00   0  0.00   0  0  0  0 100
   0   200 32.00   4  0.13   0.00   0  0.00   0.00   0  0.00   0  0  0  0 100
^C   3   294 32.00   3  0.09   0.00   0  0.00   0.00   0  0.00   1  0  1  0 99
root@thirdeye:/usr/ports # sysctl kern.geom.raid.idle_threshold=10000
kern.geom.raid.idle_threshold: 1000000 -> 10000
root@thirdeye:/usr/ports # iostat 1 -1
       tty            ada0             ada1             ada2             cpu
 tin  tout  KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id
   0     3 59.57  18  1.07  114.09   7  0.80   6.10   2  0.01   2  0  1  0 97
   0   536 126.54 478 59.02  127.74 473 58.95   0.00   0  0.00   7  0  2  0 91
   0   373 126.37 427 52.75  127.26 425 52.88   0.00   0  0.00  11  0  1  0 88
   0   196 127.16 459 56.94  128.00 448 56.06   0.00   0  0.00   2  0  1  0 97
   0   188 126.36 451 55.60  128.00 446 55.72   0.00   0  0.00   2  0  1  0 97
   0   205 126.31 387 47.78  127.34 386 48.04   0.00   0  0.00   0  0  1  0 99
   0   196 127.15 451 55.97  128.00 440 54.97   0.00   0  0.00   0  0  0  0 99
   0   196 126.73 456 56.40  128.00 457 57.09   0.00   0  0.00   0  0  0  0 100
   0   197 126.09 434 53.39  128.00 423 52.83   0.00   0  0.00   0  0  0  0 99
   0   197 126.67 433 53.58  128.00 425 53.14   0.00   0  0.00   0  0  0  0 100
   0   198 126.91 441 54.69  127.78 441 55.07   0.00   0  0.00   0  0  0  0 99
   0   196 127.24 420 52.20  127.70 417 52.02   0.00   0  0.00   0  0  0  0 99
   0   193 126.75 453 56.13  128.00 441 55.08   0.00   0  0.00   0  0  0  0 99
   0   199 127.14 452 56.16  128.00 454 56.79   0.00   0  0.00   0  0  3  1 96
   0   196 125.17 427 52.19  126.96 421 52.19   0.00   0  0.00   6  0  1  1 93
   0   195 125.48 417 51.09  128.00 398 49.75   0.00   0  0.00  15  0  3  0 82
   0   193 126.76 460 56.89  128.00 458 57.20   0.00   0  0.00   5  0  1  0 94
   0   198 126.66 434 53.62  128.00 428 53.56   0.00   0  0.00   0  0  0  0 99
   0   194 126.51 447 55.19  127.79 444 55.38   0.00   0  0.00   5  0  2  0 92
   0   200 127.11 441 54.70  128.00 433 54.07   0.00   0  0.00   0  0  0  0 100
   0   193 127.14 435 54.04  128.00 429 53.67   0.00   0  0.00   0  0  0  1 99
^C   2   227 127.02 450 55.80  128.00 449 56.08   0.00   0  0.00   0  0  0  0 100
root@thirdeye:/usr/ports # graid status
   Name    Status  Components
raid/r0  DEGRADED  ada0 (ACTIVE (ACTIVE))
                   ada1 (ACTIVE (REBUILD 46%))
raid/r1   OPTIMAL  ada2 (ACTIVE (ACTIVE))
                   ada3 (ACTIVE (ACTIVE))

socks proxy

To create socks proxy You need:
1. Server that you connect via ssh and create dynamic tunnel
2. Client application that can “wear socks”

First ssh to Your server
ssh -D someport someserver.tld
where someport i s Your dynamic socks port which You will be use
ssh -D 1080 your.server.tld