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

display some lines before and after matched pattern, using pipe to powershell

C:\Users\Administrator>ping tool.eu.org

C:\Users\Administrator>ipconfig /displaydns |powershell -Command "$input |Out-String -stream |Select-String -pattern ': tool' -Context 2,4"

       tool.eu.org
       ----------------------------------------
>      Record Name . . . . . : tool.eu.org
       Record Type . . . . . : 1
       Time To Live  . . . . : 1476
       Data Length . . . . . : 4
       Section . . . . . . . : Answer

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

always look for broken links

If you occur problem in compilation, check the file and symlink.
/usr/ports/devel/llvm80 # make
(...)
===> Building for llvm80-8.0.1_3 ninja: error: '/usr/local/lib/libexecinfo.so', needed by 'bin/lldb-argdumper', missing and no known rule to make it ===> Compilation failed unexpectedly.
% ls -l /usr/local/lib/libexecinfo.so lrwxr-xr-x 1 root wheel 16 May 19 2014 /usr/local/lib/libexecinfo.so -> libexecinfo.so.1
% which /usr/local/lib/libexecinfo.so /usr/local/lib/libexecinfo.so: Command not found.
% file /usr/local/lib/libexecinfo.so /usr/local/lib/libexecinfo.so: broken symbolic link to libexecinfo.so.1
# unlink /usr/local/lib/libexecinfo.so

Problem after upgrading Zabbix Agent on Debian (from Stretch to Buster)

If You occured the problem in /var/log/zabbix-agent/zabbix_agentd.log
Message from <Zabbix Server IP> is missing header. Message ignored.
Downgrade Zabbix Agent from 4.x to your server version.

# apt-get remove zabbix-agent
Download appropriate version from http://repo.zabbix.com/zabbix/3.0/debian/pool/main/z/zabbix/
# wget http://repo.zabbix.com/zabbix/3.0/debian/pool/main/z/zabbix/zabbix-agent_3.0.28-1%2Bbuster_amd64.deb

install it
# dpkg -i zabbix-agent_3.0.28-1+buster_amd64.deb

lock if for future upgrades
# apt-mark hold zabbix-agent

unmask
# systemctl unmask zabbix-agent

enable and start
# systemctl enable zabbix-agent
# systemctl start zabbix-agent