Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
zfs get compression zroot/var/logzfs set compression=zstd zroot/var/log# Rotate log files every hour, if necessary.
0 * * * * root newsyslog# Rotate log files every hour, if necessary.
0 * * * * root newsyslog -t DEFAULTservice newsyslog restart
service syslogd restartzfs get refcompressratio zroot/var/logNAME PROPERTY VALUE SOURCE
zroot/var/log refcompressratio 40.60x -zfs get used,logicalreferenced zroot/var/log
NAME PROPERTY VALUE SOURCE
zroot/var/log used 2.28M -
zroot/var/log logicalreferenced 91.0M -/usr/local/etc/periodic/daily、/usr/local/etc/periodic/weekly:第三方脚本,通常来自 Ports 或包,也按时间运行。例如,轮转 nginx 日志文件或备份 pkg 文件。1 3 * * * root periodic daily
15 4 * * 6 root periodic weekly
30 5 1 * * root periodic monthlydaily_backup_passwd_enable="YES"daily_output=/var/log/daily.log
weekly_output=/var/log/weekly.log
monthly_output=/var/log/monthly.log#!/bin/sh
if [ -r /etc/defaults/periodic.conf ]
then
. /etc/defaults/periodic.conf
source_periodic_confs
fi
: ${zfs_pool_usage_enable:="YES"}
: ${zfs_pool_usage_threshold:=80}
[ "$zfs_pool_usage_enable" = "YES" ] || exit 0
echo ""
echo "Checking ZFS pool usage (threshold: ${zfs_pool_usage_threshold}%)..."
zpool list -H -o name,capacity | while read -r pool usage; do
percent=${usage%%%} # 移除 '%' 符号
if [ "${percent}" -ge "${zfs_pool_usage_threshold}" ]; then
echo "WARNING: ZFS pool '${pool}' is ${percent}% full!"
else
echo "OK: ZFS pool '${pool}' is below capacity threshold (${percent}%)."
fi
done
exit 0chmod +x /etc/periodic/daily/405.zfs_pool_usagedaily_show_success="YES"
zfs_pool_usage_enable="YES"
zfs_pool_usage_threshold="75"periodic dailyChecking ZFS pool usage (threshold: 75%)...
OK: ZFS pool 'data' is below capacity threshold (6%).
OK: ZFS pool 'zroot' is below capacity threshold (27%).sysrc jail_enable="YES" && sysrc jail_parallel_start="YES"zfs create -o mountpoint=/jails zroot/jails
zfs create zroot/jails/media
zfs create zroot/jails/_basefetch https://download.freebsd.org/ftp/releases/$(uname -m)/$(freebsd-version)/base.txz -o /jails/media/$(freebsd-version)-base.txztar -xf /jails/media/$(freebsd-version)-base.txz -C /jails/_base/ --unlink
cp /etc/resolv.conf /jails/_base/etc/resolv.conf
cp /etc/localtime /jails/_base/etc/localtime
freebsd-update -b /jails/_base/ fetch install
pkg -c /jails/_base install -y pkg python zsh
zfs snapshot zroot/jails/_base@$(freebsd-version)-$(date +%d-%b-%y)# https://man.freebsd.org/jail.conf
# https://man.freebsd.org/jail
#
ip4 = inherit;
ip6 = inherit;
# 默认应用于所有 jail
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown jail";
exec.clean;
# 文件系统
mount.devfs;
devfs_ruleset=4;
enforce_statfs=1;
securelevel=2;
#allow.mount.zfs;
#allow.mount;
# 禁用所有花哨的东西
allow.mount.nodevfs;
allow.mount.nofdescfs;
allow.mount.nolinprocfs;
allow.mount.nonullfs;
allow.mount.noprocfs;
allow.mount.notmpfs;
allow.nochflags;
# 但这些总是有用的
allow.raw_sockets;
allow.reserved_ports;
allow.sysvipc=1;
# 杂项
allow.nomlock;
allow.noquotas;
allow.noread_msgbuf;
allow.noset_hostname;
allow.nosocket_af;
allow.nosysvipc;
sysvmsg=disable;
sysvsem=disable;
children.max=0;
.include "/etc/jail.conf.d/*.conf";#!/bin/sh
#
set -eo pipefail
SNAP=${2:-$(zfs list -t snapshot -H -o name | grep "jails/_base" | cut -f3 -d/)}
if [ -z $1 ]; then
echo "pass new jail name"
exit 1
else
new=$1
fi
zfs clone zroot/jails/${SNAP} zroot/jails/${new}
test -d /etc/jail.conf.d || mkdir -p /etc/jail.conf.d
cat > /etc/jail.conf.d/${new}.conf <<EOF
${new} {
host.hostname = "${new}.jail";
path = "/jails/${new}";
}
EOF
sysrc jail_list+=${new}make fetch
make extract
make patch
make build
make installmake fetch
+- make pre-fetch
+- make do-fetch
+- make post-fetch
make extract
+- make pre-extract
+- make do-extract
+- make post-extract
make patch
+- make pre-patch
+- make do-patch
+- make post-patch
make configure
+- make pre-configure
+- make do-configure
+- make post-configure
make build
+- make pre-build
+- make do-build
+- make post-fetch
make install
+- make pre-install
+- make do-install
+- make post-installmake -V_FETCH_SEQ
make -V_FETCH_REAL_SEQmake -dl# pkg install -y podman-suite# zfs create -o mountpoint=/var/db/containers zroot/containers# cp /usr/local/etc/containers/pf.conf.sample /etc/pf.conf
# sysctl net.pf.filter_local=1# service pf enable
# service pf start# service linux enable
# service linux start$ doas podman run ghcr.io/freebsd/freebsd-runtime:14.3 freebsd-version
14.3-RELEASE$ doas podman run --rm --os=linux docker.io/alpine cat /etc/os-release | head -1
NAME="Alpine Linux"$ doas podman run --os=linux -p 80:80 -v $PWD/website:/usr/share/caddy -v caddy_data:/data docker.io/caddydoas podman run -it --os=linux docker.io/phips/pandas:v3 /bin/bash# freebsd-update fetch install# pkg update# zfs create -p videostar/var/db/galene/data
# zfs create videostar/var/db/galene/groups
# zfs create videostar/var/db/galene/recordings# pkg install galene{
"users":
{
"bob":
{
"password": "secret",
"permissions": "op"
}
}
}pkg install py311-certbot
certbot certonly -d YOURHOSTSFQDN --standalone
cp /usr/local/etc/letsencrypt/live/meet.fortasse.cloud/fullchain.pem /var/db/galene/data/cert.pem
cp /usr/local/etc/letsencrypt/live/meet.fortasse.cloud/privkey.pem /var/db/galene/data/key.pem
chown galene:galene /var/db/galene/data/*
service galene restart# service galene enable# service galene start# service galene status# sockstat -l|grep galenehttps://videostar.example:8443inet autoconf
inet6 2a01:4f8:cafe:cafe::1 72
!route add -net ::/0 fe80::1%vio0sh /etc/netstart vio0ping6 google.comnet.inet.ip.forwarding=1
net.inet6.ip6.forwarding=1sysctl net.inet.ip.forwarding=1
sysctl net.inet6.ip6.forwarding=1openssl rand -base64 32172.14.0.1/24 wgport 51820 wgkey YUkS6cNTyPbXmtVf/23ppVW3gX2hZIBzlHtXNFRp80w=
inet6 2a01:4f8:cafe:cafe:100::1 72sh /etc/netstart wg0ifconfig wg0wg0: flags=80c3<UP,BROADCAST,RUNNING,NOARP,MULTICAST> mtu 1420
index 5 priority 0 llprio 3
wgport 51820
wgpubkey xxxxxxxxxxxxxxx=
groups: wg
inet 172.14.0.1 netmask 0xffffff00 broadcast 172.14.0.255
inet6 2a01:4f8:cafe:cafe:100::1 prefixlen 72#!/bin/sh
#
# this is normally run once per day via /etc/daily.local.
#
echo updating Spamhaus DROP lists:
(
{ ftp -o - https://www.spamhaus.org/drop/drop.txt && \
ftp -o - https://www.spamhaus.org/drop/dropv6.txt ; \
} 2>/dev/null | sed "s/;/#/" > /var/db/drop.txt
)
pfctl -t spamhaus -T replace -f /var/db/drop.txtchmod a+rx /usr/local/sbin/spamhaus.sh
/usr/local/sbin/spamhaus.shpfctl -f /etc/pf.confchmod a+rx /usr/local/sbin/unbound-adhosts.sh
/usr/local/sbin/unbound-adhosts.shchown -R nobody:nobody /var/unboundrcctl enable unbound
rcctl start unbound172.14.0.1/24 wgport 51820 wgkey YUkS6cNTyPbXmtVf/23ppVW3gX2hZIBzlHtXNFRp80w=
inet6 2a01:4f8:cafe:cafe:100::1 72
wgpeer *client's public key* wgaip 172.14.0.2/32 wgaip 2a01:4f8:cafe:cafe:100::2/128sh /etc/netstart wg0#!/bin/ksh
/usr/local/sbin/unbound-adhosts.sh
/usr/local/sbin/spamhaus.shfetch https://github.com/ytmdesktop/ytmdesktop/archive/v1.8.2.tar.gz
tar -xzf v1.8.2.tar.gz
less ytmdesktop-1.8.2/package.jsongit clone https://github.com/tagattie/FreeBSD-Electron.git
cp FreeBSD-Electron/Mk/Uses/*.mk ${PORTSDIR}/Mk/Usescd ${PORTSDIR}
port create multimedia/ytmdesktopcd multimedia/ytmdesktop
mkdir -p files/packagejsons
cp /path/to/archive/ytmdesktop-1.8.2/package*.json files/packagejsonsUSES= electron:7 node:12,build
USE_NODE= npmUSE_ELECTRON= prefetch extract prebuild build:builder
PREFETCH_TIMESTAMP= 1582793516"electron-builder": "^21.2.0"#! /bin/sh
export NODE_ENV=production
export ELECTRON_IS_DEV=0
electron%%ELECTRON_VER_MAJOR%% %%DATADIR%%/resources/app.asar $@do-install:
# 将包装脚本、.desktop 入口文件和图标安装到适当位置
# (此处省略部分代码)
# 安装应用程序数据目录到 ${DATADIR}
${MKDIR} ${STAGEDIR}${DATADIR}
cd ${WRKSRC}/dist/linux-unpacked && \
${COPYTREE_SHARE} resources ${STAGEDIR}${DATADIR}make makesum # 生成 distinfo
make build$ gpart create -s gpt da1$ gpart add -t freebsd-zfs -a 4k -s 4g -l ttt da1$ gpart show da1
=> 40 312581728 da1 GPT (149G)
40 8388608 1 freebsd-zfs (4.0G)
8388648 304193120 - free - (145G)
$ gpart show -l da1
=> 40 312581728 da1 GPT (149G)
40 8388608 1 ttt (4.0G)
8388648 304193120 - free - (145G)$ zpool create -O atime=off ztest gpt/ttt$ zpool status ztest
pool: ztest
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
ztest ONLINE 0 0 0
gpt/ttt ONLINE 0 0 0
errors: No known data errors$ cd /ztest$ dd if=/dev/zero of=dummy bs=4m
dd: dummy: No space left on device
928+0 records in
927+1 records out
3891134464 bytes transferred in 157.300331 secs (24736976 bytes/sec)
$$ df -b /ztest
Filesystem 512-blocks Used Avail Capacity Mounted on
ztest 7601024 7601024 0 100% /ztest$ zpool export ztest$ dd if=/dev/random of=/dev/gpt/ttt count=1 oseek=4000000
1+0 records in
1+0 records out
512 bytes transferred in 0.382043 secs (1340 bytes/sec)
$$ zpool import ztest
$ cat /ztest/dummy > /dev/null
cat: /ztest/dummy: Input/output error
$$ zpool status ztest
pool: ztest
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
ztest ONLINE 0 0 0
gpt/ttt ONLINE 0 0 0
errors: No known data errors
$$ zpool scrub ztest
$ zpool status ztest
pool: ztest
state: ONLINE
scan: scrub in progress since Mon Aug 29 18:17:33 2022
3.62G scanned at 412M/s, 550M issued at 61.1M/s, 3.62G total
0B repaired, 14.81% done, 00:00:51 to go
config:
NAME STATE READ WRITE CKSUM
ztest ONLINE 0 0 0
gpt/ttt ONLINE 0 0 0
errors: No known data errors
$ $ zpool status ztest
pool: ztest
state: ONLINE
status: One or more devices has experienced an error resulting in data
corruption. Applications may be affected.
action: Restore the file in question if possible. Otherwise restore the
entire pool from backup.
see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
scan: scrub repaired 0B in 00:01:05 with 1 errors on Mon Aug 29 18:18:32 2022
config:
NAME STATE READ WRITE CKSUM
ztest ONLINE 0 0 0
gpt/ttt ONLINE 0 0 2
errors: 1 data errors, use '-v' for a list
$$ zpool status -v ztest
pool: ztest
state: ONLINE
status: One or more devices has experienced an error resulting in data
corruption. Applications may be affected.
action: Restore the file in question if possible. Otherwise restore the
entire pool from backup.
see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
scan: scrub repaired 0B in 00:01:05 with 1 errors on Mon Aug 29 18:18:32 2022
config:
NAME STATE READ WRITE CKSUM
ztest ONLINE 0 0 0
gpt/ttt ONLINE 0 0 2
errors: Permanent errors have been detected in the following files:
/ztest/dummy
$$ cat /ztest/dummy > /dev/null
cat: /ztest/dummy: Input/output error
$$ zpool export ztest
$ dd if=/dev/zero of=/dev/gpt/ttt count=1 oseek=4000000
1+0 records in
1+0 records out
512 bytes transferred in 0.382715 secs (1338 bytes/sec)
$$ zpool import ztest
$ cat /ztest/dummy > /dev/null
$$ zpool status ztest
pool: ztest
state: ONLINE
status: One or more devices has experienced an error resulting in data
corruption. Applications may be affected.
action: Restore the file in question if possible. Otherwise restore the
entire pool from backup.
see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
scan: scrub repaired 0B in 00:01:05 with 1 errors on Mon Aug 29 18:18:32 2022
config:
NAME STATE READ WRITE CKSUM
ztest ONLINE 0 0 0
gpt/ttt ONLINE 0 0 0
errors: 1 data errors, use '-v' for a list
$$ zpool scrub ztest$ zpool status ztest
pool: ztest
state: ONLINE
scan: scrub repaired 0B in 00:01:05 with 0 errors on Mon Aug 29 18:34:27 2022
config:
NAME STATE READ WRITE CKSUM
ztest ONLINE 0 0 0
gpt/ttt ONLINE 0 0 0
errors: No known data errors
$
# sysctl net.wlan.devices
net.wlan.devices: iwn0# dmesg
(...)
ugen2.3: at usbus2
rtwn0 on uhub4
rtwn0: on usbus2
rtwn0: MAC/BB RTL8188CUS, RF 6052 1T1R# usbconfig
(...)
ugen2.3: at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
# usbconfig -d 2.3 show_ifdrv
ugen2.3: at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
ugen2.3.0: rtwn0:# sysctl net.wlan.devices
net.wlan.devices: rtwn0 iwn0# ifconfig wlan1 create wlandev rtwn0
# ifconfig wlan1
wlan1: flags=8802<broadcast,simplex,multicast> metric 0 mtu 1500
ether 00:1d:43:21:2d:1c
groups: wlan
ssid "" channel 1 (2412 MHz 11b)
regdomain FCC country US authmode OPEN privacy OFF txpower 30 bmiss 7
scanvalid 60 wme bintval 0
parent interface: rtwn0
media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
status: no carrier
nd6 options=21<performnud,auto_linklocal>
# wpa_passphrase WIFINETWORK PASSWORD >> /etc/wpa_supplicant.conf
# wpa_supplicant -i wlan1 -c /etc/wpa_supplicant.conf
Successfully initialized wpa_supplicant
wlan1: Trying to associate with d8:07:b8:b8:f4:81 (SSID='wireless' freq=2442 MHz)
wlan1: Associated with d8:07:b6:b8:f4:81
wlan1: WPA: Key negotiation completed with d8:07:b6:b8:f4:81 [PTK=CCMP GTK=CCMP]
wlan1: CTRL-EVENT-CONNECTED - Connection to d8:07:b6:b8:f4:81 completed [id=40 id_str=]
^Z // 在这里按 [CTRL]+[Z] 键
zsh: suspended wpa_supplicant -i wlan1 -c /etc/wpa_supplicant.conf
# bg
[1] + continued wpa_supplicant -i wlan1 -c /etc/wpa_supplicant.conf
## ps ax | grep wpa_supplicant
48693 4 S 0:00.43 wpa_supplicant -i wlan1 -c /etc/wpa_supplicant.conf
50687 4 S+ 0:00.00 grep --color wpa_supplicant
# ifconfig wlan1
wlan1: flags=8843<up,broadcast,running,simplex,multicast> metric 0 mtu 1500
ether 00:1d:43:21:2d:1c
groups: wlan
ssid wireless channel 7 (2442 MHz 11g ht/20) bssid d8:07:b6:b8:f4:81
regdomain FCC country US authmode WPA2/802.11i privacy ON
deftxkey UNDEF AES-CCM 2:128-bit txpower 30 bmiss 7 scanvalid 60
protmode CTS ht20 ampdulimit 64k ampdudensity 4 shortgi -stbc -ldpc
-uapsd wme roaming MANUAL
parent interface: rtwn0
media: IEEE 802.11 Wireless Ethernet MCS mode 11ng
status: associated
nd6 options=29<performnud,ifdisabled,auto_linklocal># dhclient wlan1
DHCPDISCOVER on wlan1 to 255.255.255.255 port 67 interval 3
DHCPOFFER from 10.0.0.1
DHCPREQUEST on wlan1 to 255.255.255.255 port 67
DHCPACK from 10.0.0.1
bound to 10.0.0.9 -- renewal in 3600 seconds.# echo nameserver 1.1.1.1 > /etc/resolv.conf
# ping -c 3 freebsd.org
PING freebsd.org (96.47.72.84): 56 data bytes
64 bytes from 96.47.72.84: icmp_seq=0 ttl=50 time=119.870 ms
64 bytes from 96.47.72.84: icmp_seq=1 ttl=50 time=119.371 ms
64 bytes from 96.47.72.84: icmp_seq=2 ttl=50 time=119.128 ms
--- freebsd.org ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 119.128/119.456/119.870/0.309 ms服务器 ==局域网==> 路由器 ==WiFi==> 笔记本 @ 2.9 MB/s笔记本 ==WiFi==> 路由器 ==局域网==> 服务器 @ 2.6 MB/s(host) # beadm create 13 # 创建新的 '13' ZFS Boot Environment
Created successfully
(host) # beadm mount 13 /var/tmp/BE-13 # 将新的 '13' BE 挂载到某个目录
Mounted successfully on '/var/tmp/BE-13'
(host) # chroot /var/tmp/BE-13 # 切换到该目录的 chroot(8) 环境
(BE) # mount -t devfs devfs /dev # 在该 BE 中挂载 devfs(8)
(BE) # rm -rf /var/db/freebsd-update # 删除任何旧补丁
(BE) # mkdir /var/db/freebsd-update # 为补丁创建新的目录
(BE) # freebsd-update upgrade -r 13.0-BETA3 # 获取升级所需的补丁
(BE) # freebsd-update install # 安装内核及内核模块
(BE) # freebsd-update install # 安装用户空间程序/二进制文件/库
(BE) # pkg upgrade # 使用 pkg(8) 升级所有软件包
(BE) # freebsd-update install # 移除旧的库和文件
(BE) # exit # 退出 chroot(8) 环境
(host) # umount -f /var/tmp/BE-13/dev # 卸载该 BE 中的 devfs(8)
(host) # beadm activate 13 # 激活新的 '13' BE
Activated successfully(host) # gpart show -p ada1 | grep efi # 查找 UEFI msdosfs(5) 分区
40 409600 ada1p1 efi (200M) # <-- 就是这一项
(host) # mount_msdosfs /dev/ada1p1 /mnt # 将其挂载到 /mnt 下
(host) # find /mnt # 显示其内容
/mnt
/mnt/efi
/mnt/efi/boot
/mnt/efi/boot/bootx64.efi # 更新 bootx64.efi 文件
(host) # cp /boot/boot1.efi /mnt/efi/boot/bootx64.efi # 从 /boot/boot1.efi 文件复制
(host) # umount -f /mnt # 卸载 /mnt 文件系统(host) # mount_msdosfs /dev/ada1p1 /mnt # 尝试挂载 EFI 分区时出错
mount_msdosfs: /dev/ada1p1: Invalid argument
(host) # fsck_msdosfs -y /dev/ada1p1 # 尝试对该分区执行 fsck(8) 时出错
** /dev/ada1p1
Invalid signature in boot block: 0b6a(host) # dd < /dev/ada1p1 > /BACKUP.ada1p1 bs=1m(host) # newfs_msdos -F 32 -c 1 /dev/ada0p1 # 创建新的 FAT32 分区
(host) # mount_msdosfs /dev/ada0p1 /mnt # 挂载到 /mnt 下
(host) # mkdir -p /mnt/efi/boot # 创建所需目录
(host) # cp /boot/loader.efi /mnt/efi/boot/bootx64.efi # 从 /boot/loader.efi 复制文件
(host) # umount -f /mnt # 卸载 /mnt 文件系统(host) # reboot(host) # beadm list
BE Active Mountpoint Space Created
12.2 - - 6.5G 2021-02-12 10:15
13 NR / 18.8G 2021-02-13 11:32(host) # beadm list -D
BE Active Mountpoint Space Created
12.2 - - 9.8G 2021-02-12 10:15
13 NR / 9.6G 2021-02-13 11:32(host) # beadm destroy 12.2# dd if=FreeBSD-13.0-BETA3-amd64-memstick.img of=/dev/da0 bs=1M status=progress# fetch -o /usr/local/sbin/beadm https://raw.githubusercontent.com/vermaden/beadm# beadm create 13.1-RC6
# beadm chroot 13.1-RC6
BE # zsh || csh
BE # yes | freebsd-update upgrade -r 13.1-RC6
BE # 重复执行 3 次 freebsd-update install
BE # exit
# beadm activate 13.1-RC6
# reboot# beadm create 13.1-RC6
# beadm chroot 13.1-RC6
BE # sh || bash || fish || ksh
BE # yes | freebsd-update upgrade -r 13.1-RC6
BE # seq 3 | xargs -I- freebsd-update install
BE # exit
# beadm activate 13.1-RC6
# rebootroot@fbsd12:~ # beadm
usage:
beadm activate
beadm create [-e nonActiveBe | -e beName@snapshot]
beadm create
beadm destroy [-F]
beadm list [-a] [-s] [-D] [-H]
beadm rename
beadm mount [mountpoint]
beadm { umount | unmount } [-f]
beadm versionroot@fbsd12:~ # bectl
missing command
usage: bectl ( -h | -? | subcommand [args...] )
bectl activate [-t] beName
bectl create [-e nonActiveBe | -e beName@snapshot] beName
bectl create beName@snapshot
bectl destroy [-F] beName | beName@snapshot⟩
bectl export sourceBe
bectl import targetBe
bectl jail [ -o key=value | -u key ]... bootenv
bectl list [-a] [-D] [-H] [-s]
bectl mount beName [mountpoint]
bectl rename origBeName newBeName
bectl { ujail | unjail } ⟨jailID | jailName | bootenv)
bectl { umount | unmount } [-f] beNameroot@fbsd12:~ # bectl rename safe new
boot environment is already mounted
failed to rename bootenv safe to newroot@fbsd12:~ # bectl list
BE Active Mountpoint Space Created
safe NR / 188K 2018-08-18 02:32
default - - 427M 2018-08-18 02:26
root@fbsd12:~ # zfs list | grep safe
zroot/ROOT/safe 108K 6.85G 427M /
root@fbsd12:~ # zfs rename -u zroot/ROOT/safe zroot/ROOT/newroot@fbsd12:~ # bectl list
BE Active Mountpoint Space Created
new NR / 188K 2018-08-18 02:32
default - - 427M 2018-08-18 02:26root@fbsd12:~ # bectl list
BE Active Mountpoint Space Created
new NR / 188K 2018-08-18 02:32
default - - 427M 2018-08-18 02:26
root@fbsd12:~ # bectl jail default
# pwd
/
# ls /
.cshrc bin entropy libexec net root usr
.profile boot etc media proc sbin var
COPYRIGHT dev lib mnt rescue tmp zroot
# exit
root@fbsd12:~ # jls
JID IP Address Hostname Path
1 default /tmp/be_mount.OnRc
root@fbsd12:~ # mount | grep default
zroot/ROOT/default on /tmp/be_mount.OnRc (zfs, local, noatime, nfsv4acls)
root@fbsd12:~ # bectl unjail default
root@fbsd12:~ # jls
JID IP Address Hostname Pathroot@fbsd12:~ # bectl list
BE Active Mountpoint Space Created
new NR / 188K 2018-08-18 02:32
default - - 427M 2018-08-18 02:26
root@fbsd12:~ # beadm destroy safe
Are you sure you want to destroy 'safe'?
This action cannot be undone (y/[n]): n
root@fbsd12:~ # bectl destroy safe
root@fbsd12:~ # bectl list
BE Active Mountpoint Space Created
new NR / 188K 2018-08-18 02:32# alias beadm=bectl# alias beadm bectl

freebsd # mkdir -p /jail/test
freebsd # fetch https://download.freebsd.org/releases/amd64/14.2-RELEASE/base.txz
freebsd # tar -C /jail/test --unlink -xf base.txzfreebsd # mkdir -p /jail/minimal/dev
freebsd # cp /rescue/sh /jail/minimalfreebsd # jail -n minimal \
-c path=/jail/minimal \
host.hostname=minimal \
ip4.addr=10.0.0.111 \
mount.devfs \
command=/sh
minimal # /sh
Cannot read termcap database;
using dumb terminal settings.
minimal # for I in 1 2 3; do echo ${I}; done
1
2
3
minimal # echo /*
/dev /shfreebsd # jls
JID IP Address Hostname Path
1 10.0.0.111 minimal /jail/minimal% links -dump -width 512 'https://app.opencve.io/cve/?vendor=linux' | grep -i TOTAL
Total 10064 CVE% links -dump -width 512 'https://app.opencve.io/cve/?search=podman' | grep -i TOTAL
Total 24 CVE% links -dump -width 512 'https://app.opencve.io/cve/?vendor=freebsd' | grep -i TOTAL
Total 557 CVE
% links -dump -width 512 https://www.freebsd.org/security/advisories/ | grep -c BSD-SA
649% links -dump -width 512 https://freebsd.org/security/advisories/ | grep -i jail
2021-04-06 FreeBSD-SA-21:10.jail_mount
2021-02-24 FreeBSD-SA-21:05.jail_chdir
2021-02-24 FreeBSD-SA-21:04.jail_remove
2020-03-19 FreeBSD-SA-20:08.jail
2010-05-27 FreeBSD-SA-10:04.jail
2007-01-11 FreeBSD-SA-07:01.jail
2004-06-07 FreeBSD-SA-04:12.jailroute
2004-02-25 FreeBSD-SA-04:03.jail
% links -dump -width 512 https://freebsd.org/security/advisories/ | grep -c jail
8% links -dump -width 512 'https://app.opencve.io/cve/?search=jail&vendor=freebsd' | grep -i TOTAL
Total 18 CVElinux # man 7 capabilities | grep -m 1 firewall
- administration of IP firewall, masquerading, and accounting;gpart create -s GPT ada0gpart add -t freebsd-ufs ada0
gpart add -t freebsd-swap ada0gpart add -t freebsd-boot -b 40 -s 984 ada0gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0
或者
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0gpart add -t efi -b 40 -s 409560 ada0newfs_msdos -F 32 -c 1 -L EFISYS /dev/ada0p1
mount -t msdosfs /dev/ada0p1 /mnt
mkdir -p /mnt/EFI/BOOT
cp /boot/loader.efi /mnt/EFI/BOOT/BOOTX64.efi
umount /mnt
或者
gpart bootcode -p /boot/boot1.efifat -i 1 ada0gpart bootcode -p /boot/gptboot -i 1 ada0
或
gpart bootcode -p /boot/gptzfsboot -i 1 ada0# Device Mountpoint FStype Options Dump Pass #
/dev/ada0p1 /boot/efi msdosfs rw 0 0mkdir -p /boot/efimount /boot/eficp /boot/loader.efi /boot/efi/EFI/BOOT/BOOTX64.efi/boot/boot1.efifat)的大小为 800KiB。









ccache -M 32GWITH_CCACHE_BUILD= yescache directory /root/.ccache
primary config /root/.ccache/ccache.conf
secondary config (readonly) /usr/local/etc/ccache.conf
cache hit (direct) 5
cache hit (preprocessed) 77
cache miss 46123
cache hit rate 0.18 %
called for link 116
ccache internal error 1
unsupported code directive 3
no input file 1
cleanups performed 0
files in cache 137311
cache size 2.7 MB
max cache size 32.0 GBcache directory /root/.ccache
primary config /root/.ccache/ccache.conf
secondary config (readonly) /usr/local/etc/ccache.conf
cache hit (direct) 45050
cache hit (preprocessed) 1237
cache miss 46123
cache hit rate 50.09 %
called for link 232
ccache internal error 2
unsupported code directive 6
no input file 2
cleanups performed 0
files in cache 137454
cache size 2.7 MB
max cache size 32.0 GBcache directory /root/.ccache
primary config /root/.ccache/ccache.conf
secondary config (readonly) /usr/local/etc/ccache.conf
cache hit (direct) 45186
cache hit (preprocessed) 1019
cache miss 0
cache hit rate 100.00 %
called for link 116
ccache internal error 1
unsupported code directive 3
no input file 1
cleanups performed 0
files in cache 137578
cache size 2.7 MB
max cache size 32.0 GBcache directory /root/.ccache
primary config /root/.ccache/ccache.conf
secondary config (readonly) /usr/local/etc/ccache.conf
cache hit (direct) 45186
cache hit (preprocessed) 1019
cache miss 0
cache hit rate 100.00 %
called for link 116
ccache internal error 1
unsupported code directive 3
no input file 1
cleanups performed 0
files in cache 137578
cache size 4.5 GB
max cache size 32.0 GB$ pkg install got$ git clone https://git.freebsd.org/ports.git /usr/ports$ got clone -am ssh://[email protected]/ports.git /home/ports.git
$ got checkout /home/ports.git /usr/ports$ git clone --bare --single-branch ssh://[email protected]/ports.git
Cloning into bare repository 'ports.git'...
remote: Enumerating objects: 5942473, done.
remote: Counting objects: 100% (171767/171767), done.
remote: Compressing objects: 100% (16358/16358), done.
remote: Total 5942473 (delta 167421), reused 155423 (delta 155409), pack-reused 5770706
Receiving objects: 100% (5942473/5942473), 1.12 GiB | 11.01 MiB/s, done.
Resolving deltas: 100% (3577978/3577978), done.$ got clone ssh://[email protected]/ports.git
Connecting to ssh://[email protected]/ports.git
server: Enumerating objects: 5963414, done.
server: Counting objects: 100% (133228/133228), done.
server: Compressing objects: 100% (13237/13237), done.
server: Total 5963414 (delta 129757), reused 119991 (delta 119991), pack-reused 5830186
1157M fetched; indexing 100%; resolving deltas 100%
Fetched 0d39a9d41ecbf5cd111bcc9ae9f2cfcf7e30a616.pack
Created cloned repository 'ports.git'git clone --bare --single-branch ssh://[email protected]/ports.git
511.72s user 40.21s system 163% cpu 5:36.76 total
got clone ssh://[email protected]/ports.git
660.88s user 75.82s system 87% cpu 14:00.91 total$ cd /usr/ports && git pull$ cd /usr/ports && got fetch && got update$ gotadmin info -r /home/ports.git
repository: /home/ports.git
remote "origin": ssh://[email protected]/ports.git
pack files: 4
packed objects: 5963321
packed total size: 1318M
loose objects: 0$ cd /usr/ports
$ gotadmin info
repository: /home/ports.git
remote "origin": ssh://[email protected]/ports.git
pack files: 4
packed objects: 5963321
packed total size: 1318M
loose objects: 0
$ got info
work tree: /usr/ports
work tree base commit: 388fa384c1dab4774d4db755ec1089b57e6f9a97
work tree path prefix: /
work tree branch reference: refs/heads/main
work tree UUID: 0c2bbcf5-8a1d-11ee-8d56-9ca3ba01eed8
repository: /home/ports.git$ got clone -m ssh://[email protected]/ports.git /usr/ports/.git
Connecting to ssh://[email protected]/ports.git
:
Created mirrored repository '/usr/ports/.git'
$ got checkout /usr/ports/.git /usr/ports/
got: work tree and repository paths may not overlap: /usr/ports/.git: bad path








zroot/tmp
zroot/usr/home
zroot/usr/ports
zroot/usr/src
zroot/var/audit
zroot/var/crash
zroot/var/log
zroot/var/mail
zroot/var/tmproot@freebsd:~ # zfs set mountpoint=none zroot
root@freebsd:~ # zfs list
NAME USED AVAIL REFER MOUNTPOINT
zroot 385M 18.5G 96K none
zroot/ROOT 383M 18.5G 96K none
zroot/ROOT/default 383M 18.5G 383M /
zroot/home 96K 18.5G 96K /home
zroot/tmp 96K 18.5G 96K /tmp
zroot/usr 288K 18.5G 96K /usr
zroot/usr/ports 96K 18.5G 96K /usr/ports
zroot/usr/src 96K 18.5G 96K /usr/src
zroot/var 600K 18.5G 96K /var
zroot/var/audit 96K 18.5G 96K /var/audit
zroot/var/crash 96K 18.5G 96K /var/crash
zroot/var/log 120K 18.5G 120K /var/log
zroot/var/mail 96K 18.5G 96K /var/mail
zroot/var/tmp 96K 18.5G 96K /var/tmp
root@freebsd:~ # zfs get canmount
NAME PROPERTY VALUE SOURCE
zroot canmount on default
zroot/ROOT canmount on default
zroot/ROOT/default canmount noauto local
zroot/home canmount on default
zroot/tmp canmount on default
zroot/usr canmount off local
zroot/usr/ports canmount on default
zroot/usr/src canmount on default
zroot/var canmount off local
zroot/var/audit canmount on default
zroot/var/crash canmount on default
zroot/var/log canmount on default
zroot/var/mail canmount on default
zroot/var/tmp canmount on defaultroot@freebsd:~ # df -g /usr
Filesystem 1G-blocks Used Avail Capacity Mounted on
zroot/ROOT/default 18 0 18 2% /
root@freebsd:~ # df -g /var
Filesystem 1G-blocks Used Avail Capacity Mounted on
zroot/ROOT/default 18 0 18 2% /root@freebsd:~ # zfs list
NAME USED AVAIL REFER MOUNTPOINT
zroot 385M 18.5G 96K none
zroot/ROOT 383M 18.5G 96K none
zroot/ROOT/default 383M 18.5G 383M /
zroot/home 96K 18.5G 96K /home
zroot/tmp 96K 18.5G 96K /tmp
zroot/usr 288K 18.5G 96K /usr
zroot/usr/ports 96K 18.5G 96K /usr/ports
zroot/usr/src 96K 18.5G 96K /usr/src
zroot/var 600K 18.5G 96K /var
zroot/var/audit 96K 18.5G 96K /var/audit
zroot/var/crash 96K 18.5G 96K /var/crash
zroot/var/log 120K 18.5G 120K /var/log
zroot/var/mail 96K 18.5G 96K /var/mail
zroot/var/tmp 96K 18.5G 96K /var/tmp
root@freebsd:~ # zfs create -o canmount=off -o mountpoint=none zroot/exclude
root@freebsd:~ # zfs rename -u zroot/usr zroot/exclude/usr
root@freebsd:~ # zfs rename -u zroot/var zroot/exclude/var
root@freebsd:~ # zfs rename -u zroot/home zroot/exclude/home
root@freebsd:~ # zfs rename -u zroot/tmp zroot/exclude/tmp
root@freebsd:~ # zfs list
NAME USED AVAIL REFER MOUNTPOINT
zroot 385M 18.5G 96K none
zroot/ROOT 383M 18.5G 96K none
zroot/ROOT/default 383M 18.5G 383M /
zroot/exclude 1.16M 18.5G 96K none
zroot/exclude/home 96K 18.5G 96K /home
zroot/exclude/tmp 96K 18.5G 96K /tmp
zroot/exclude/usr 288K 18.5G 96K /usr
zroot/exclude/usr/ports 96K 18.5G 96K /usr/ports
zroot/exclude/usr/src 96K 18.5G 96K /usr/src
zroot/exclude/var 612K 18.5G 96K /var
zroot/exclude/var/audit 96K 18.5G 96K /var/audit
zroot/exclude/var/crash 96K 18.5G 96K /var/crash
zroot/exclude/var/log 132K 18.5G 132K /var/log
zroot/exclude/var/mail 96K 18.5G 96K /var/mail
zroot/exclude/var/tmp 96K 18.5G 96K /var/tmproot@freebsd:~ # df -g /usr
Filesystem 1G-blocks Used Avail Capacity Mounted on
zroot/ROOT/default 18 0 18 2% /
root@freebsd:~ # df -g /var
Filesystem 1G-blocks Used Avail Capacity Mounted on
zroot/ROOT/default 18 0 18 2% /root@freebsd:~ # zfs set -u mountpoint=/var/tmp zroot/exclude/var/tmp
root@freebsd:~ # zfs set -u mountpoint=/var/mail zroot/exclude/var/mail
root@freebsd:~ # zfs set -u mountpoint=/var/log zroot/exclude/var/log
root@freebsd:~ # zfs set -u mountpoint=/var/crash zroot/exclude/var/crash
root@freebsd:~ # zfs set -u mountpoint=/var/audit zroot/exclude/var/audit
root@freebsd:~ # zfs set -u mountpoint=none zroot/exclude/var
root@freebsd:~ # zfs set -u mountpoint=/usr/src zroot/exclude/usr/src
root@freebsd:~ # zfs set -u mountpoint=/usr/ports zroot/exclude/usr/ports
root@freebsd:~ # zfs set -u mountpoint=none zroot/exclude/usr
root@freebsd:~ # zfs list
NAME USED AVAIL REFER MOUNTPOINT
zroot 385M 18.5G 96K none
zroot/ROOT 383M 18.5G 96K none
zroot/ROOT/default 383M 18.5G 383M /
zroot/exclude 1.16M 18.5G 96K none
zroot/exclude/home 96K 18.5G 96K /home
zroot/exclude/tmp 96K 18.5G 96K /tmp
zroot/exclude/usr 288K 18.5G 96K none
zroot/exclude/usr/ports 96K 18.5G 96K /usr/ports
zroot/exclude/usr/src 96K 18.5G 96K /usr/src
zroot/exclude/var 612K 18.5G 96K none
zroot/exclude/var/audit 96K 18.5G 96K /var/audit
zroot/exclude/var/crash 96K 18.5G 96K /var/crash
zroot/exclude/var/log 132K 18.5G 132K /var/log
zroot/exclude/var/mail 96K 18.5G 96K /var/mail
zroot/exclude/var/tmp 96K 18.5G 96K /var/tmp
root@freebsd:~ # df -g
Filesystem 1G-blocks Used Avail Capacity Mounted on
/dev/gpt/efiboot0 0 0 0 0% /boot/efi
devfs 0 0 0 0% /dev
zroot/ROOT/default 18 0 18 2% /
zroot/exclude/tmp 18 0 18 0% /tmp
zroot/exclude/home 18 0 18 0% /home
zroot/exclude/var/log 18 0 18 0% /var/log
zroot/exclude/var/tmp 18 0 18 0% /var/tmp
zroot/exclude/var/mail 18 0 18 0% /var/mail
zroot/exclude/var/crash 18 0 18 0% /var/crash
zroot/exclude/var/audit 18 0 18 0% /var/audit
zroot/exclude/usr/src 18 0 18 0% /usr/src
zroot/exclude/usr/ports 18 0 18 0% /usr/ports |
ZFS DATASET | ZFS MOUNTPOINT => WHY
|
+-------------------+ |
| ZFS 'zroot' pool | | /sys => # zfs set mountpoint=/sys sys
| (dataset) | | canmount:on => # zfs set canmount=on sys
+---------+---------+ |
| |
+-------+-------+ |
| ROOT | | (none) => # zfs set mountpoint=none sys/ROOT
| (dataset) | | canmount:on => # zfs set canmount=on sys/ROOT
+-------+-------+ |
| |
+-----+-----+ |
| default | | / => # zfs set mountpoint=/ sys/ROOT/${DATASET}
| (dataset) | | canmount:noauto => # zfs set canmount=noauto sys/ROOT/${DATASET}
+--+-----------+ |
| |
+- @2025-11-11@10:10 | point-in-time => # zfs snapshot sys/ROOT/${DATASET}@2025-11-11@10:10
| (snapshot) | (read only) # beadm create sys/ROOT/${DATASET}@2025-11-11@10:10
| |
+- safe | clone => # zfs clone sys/ROOT/${DATASET}@2025-11-11@10:10 sys/ROOT/safe
| (clone) | (writable) # beadm create -e default@2025-11-11@10:10 safe
| |
+- test | clone => # zfs clone sys/ROOT/${DATASET}@2025-11-11@10:10 sys/ROOT/test
(clone) | (writable) # beadm create -e default@2025-11-11@10:10 test
|root@freebsd:~ # beadm list
BE Active Mountpoint Space Created
default NR / 24.0G 2025-10-08 01:42
safe - - 1.3G 2025-06-10 09:47
test - - 6.4G 2025-08-22 23:02
root@freebsd:~ # zfs list -r -t all zroot/ROOT
NAME USED AVAIL REFER MOUNTPOINT
zroot/ROOT 29.8G 154G 96K none
zroot/ROOT/default 748K 154G 19.5G /
zroot/ROOT/default@2025-11-11@10:10 16.1G - 24.2G -
zroot/ROOT/safe 8K 154G 20.5G /
zroot/ROOT/test 810M 154G 20.9G /
root@freebsd:~ # beadm list -a
BE/Dataset/Snapshot Active Mountpoint Space Created
default
zroot/ROOT/default NR / 24.0G 2025-10-08 01:42
safe
zroot/ROOT/safe - - 748.0K 2025-06-10 09:47
default@2025-11-11@10:10 - - 1.3G 2025-10-08 01:42
test
zroot/ROOT/test - - 810.0M 2025-08-22 23:02
default@2025-11-11@10:10 - - 5.6G 2025-08-22 23:02
root@freebsd:~ # zfs get origin zroot/ROOT/default
NAME PROPERTY VALUE SOURCE
zroot/ROOT/default origin - -
root@freebsd:~ # zfs get origin zroot/ROOT/safe
NAME PROPERTY VALUE SOURCE
zroot/ROOT/safe origin zroot/ROOT/default@2025-11-11@10:10 -
root@freebsd:~ # zfs get origin zroot/ROOT/test
NAME PROPERTY VALUE SOURCE
zroot/ROOT/test origin zroot/ROOT/default@2025-11-11@10:10 -
root@freebsd:~ # zpool get bootfs
NAME PROPERTY VALUE SOURCE
zdata bootfs - default
zroot bootfs zroot/ROOT/default local |
ZFS DATASET | MOUNTPOINT => WHY
|
+-----------------------+ |
| ZFS 'zroot' pool | | /sys => # zfs set mountpoint=/sys sys
| (ZFS dataset) | | canmount:on => # zfs set canmount=on sys
+-----------+-----------+ |
| |
+---------+---------+ |
| ROOT | | (none) => # zfs set mountpoint=none sys/ROOT
| (ZFS dataset) | | canmount:on => # zfs set canmount=on sys/ROOT
+---------+---------+ |
| |
+--------------+----------+ |
| | | |
+----+----+ +-------+---+ +----+----+ |
| default | | 15.0-RC1 | | 12.2 | | / => # zfs set mountpoint=/ sys/ROOT/${DATASET}
|(dataset)| | (dataset) | |(dataset)| | canmount:noauto => # zfs set canmount=noauto sys/ROOT/${DATASET}
+---------+ +-----------+ +---------+ |
|root@freebsd:~ # beadm export 14.3 | mbuffer | ssh 10.26 doas beadm import 14.3.w520
summary: 30.3 GiByte in 34min 04.8sec - average of 15.2 MiB/s


$ zpool list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
zroot 228G 16.8G 211G - - 12% 7% 1.00x ONLINE -
zvol0 1.81T 1.49T 333G - - 5% 82% 1.00x ONLINE -
$$ zpool list -v zvol0
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH
zvol0 1.81T 1.49T 333G - - 5% 82% 1.00x ONLINE -
mirror-0 1.81T 1.49T 333G - - 5% 82.1% - ONLINE
gpt/ndisk2 - - - - - - - - ONLINE
gpt/ndisk1 - - - - - - - - ONLINE
$$ zpool status zvol0
pool: zvol0
state: ONLINE
scan: scrub repaired 0B in 05:36:58 with 0 errors on Tue Jan 17 08:40:57 2023
config:
NAME STATE READ WRITE CKSUM
zvol0 ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
gpt/ndisk2 ONLINE 0 0 0
gpt/ndisk1 ONLINE 0 0 0
errors: No known data errors
$$ gpart show ada1 ada2
=> 40 3907029088 ada1 GPT (1.8T)
40 3907029088 1 freebsd-zfs (1.8T)
=> 40 3907029088 ada2 GPT (1.8T)
40 3907029088 1 freebsd-zfs (1.8T)
$ gpart show -l ada1 ada2
=> 40 3907029088 ada1 GPT (1.8T)
40 3907029088 1 ndisk1 (1.8T)
=> 40 3907029088 ada2 GPT (1.8T)
40 3907029088 1 ndisk2 (1.8T)
$$ zpool list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
zroot 228G 16.8G 211G - - 12% 7% 1.00x ONLINE -
zvol0 1.81T 1.49T 333G - - 5% 82% 1.00x DEGRADED -
$$ zpool status zvol0
pool: zvol0
state: DEGRADED
status: One or more devices could not be opened. Sufficient replicas exist for
the pool to continue functioning in a degraded state.
action: Attach the missing device and online it using 'zpool online'.
see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-2Q
scan: scrub repaired 0B in 05:36:58 with 0 errors on Tue Jan 17 08:40:57 2023
config:
NAME STATE READ WRITE CKSUM
zvol0 DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
12897545936258916783 UNAVAIL 0 0 0 was /dev/gpt/ndisk2
gpt/ndisk1 ONLINE 0 0 0
errors: No known data errors
$$ gpart show ada1
gpart: No such geom: ada1.
$ gpart create -s gpt ada1
ada1 created
$ gpart show ada1
=> 40 11721045088 ada1 GPT (5.5T)
40 11721045088 - free - (5.5T)
$$ gpart add -t freebsd-zfs -a 4k -l sdisk1 ada1
ada1p1 added
$ gpart show ada1
=> 40 11721045088 ada1 GPT (5.5T)
40 11721045088 1 freebsd-zfs (5.5T)
$ gpart show -l ada1
=> 40 11721045088 ada1 GPT (5.5T)
40 11721045088 1 sdisk1 (5.5T)
$$ zpool replace zvol0 12897545936258916783 gpt/sdisk1
$$ zpool status zvol0
pool: zvol0
state: DEGRADED
status: One or more devices is currently being resilvered. The pool will
continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
scan: resilver in progress since Sat Jan 28 14:25:44 2023
12.8G scanned at 596M/s, 600K issued at 27.3K/s, 1.49T total
0B resilvered, 0.00% done, no estimated completion time
config:
NAME STATE READ WRITE CKSUM
zvol0 DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
replacing-0 DEGRADED 0 0 0
12897545936258916783 UNAVAIL 0 0 0 was /dev/gpt/ndisk2
gpt/sdisk1 ONLINE 0 0 0
gpt/ndisk1 ONLINE 0 0 0
errors: No known data errors
$$ zpool status zvol0
===== <省略> =====
scan: resilver in progress since Sat Jan 28 14:25:44 2023
265G scanned at 664M/s, 6.51G issued at 16.3M/s, 1.49T total
6.51G resilvered, 0.43% done, 1 days 02:27:43 to go
===== <省略> =====
$$ zpool status zvol0
===== <省略> =====
scan: resilver in progress since Sat Jan 28 14:25:44 2023
289G scanned at 488M/s, 18.6G issued at 31.4M/s, 1.49T total
18.6G resilvered, 1.22% done, 13:38:30 to go
===== <省略> =====
$$ zpool list -v zvol0
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
zvol0 1.81T 1.49T 333G - - 5% 82% 1.00x ONLINE -
mirror-0 1.81T 1.49T 333G - - 5% 82.1% - ONLINE
gpt/sdisk1 - - - - - - - - ONLINE
gpt/ndisk1 - - - - - - - - ONLINE
$$ zpool status zvol0
pool: zvol0
state: ONLINE
scan: resilvered 1.49T in 15:34:45 with 0 errors on Sun Jan 29 06:00:29 2023
config:
NAME STATE READ WRITE CKSUM
zvol0 ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
gpt/sdisk1 ONLINE 0 0 0
gpt/ndisk1 ONLINE 0 0 0
errors: No known data errors
$$ zpool status zvol0
pool: zvol0
state: DEGRADED
status: One or more devices could not be opened. Sufficient replicas exist for
the pool to continue functioning in a degraded state.
action: Attach the missing device and online it using 'zpool online'.
see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-2Q
scan: resilvered 1.49T in 15:34:45 with 0 errors on Sun Jan 29 06:00:29 2023
config:
NAME STATE READ WRITE CKSUM
zvol0 DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
gpt/sdisk1 ONLINE 0 0 0
13953654332474917058 UNAVAIL 0 0 0 was /dev/gpt/ndisk1
errors: No known data errors
$# gpart create -s gpt ada2
ada2 created
# gpart show ada2
=> 40 11721045088 ada2 GPT (5.5T)
40 11721045088 - free - (5.5T)
# gpart add -t freebsd-zfs -a 4k -l sdisk2 ada2
ada2p1 added
# gpart show ada2
=> 40 11721045088 ada2 GPT (5.5T)
40 11721045088 1 freebsd-zfs (5.5T)
# gpart show -l ada2
=> 40 11721045088 ada2 GPT (5.5T)
40 11721045088 1 sdisk2 (5.5T)
#
$ zpool replace zvol0 13953654332474917058 gpt/sdisk2
$ zpool status zvol0
pool: zvol0
state: DEGRADED
status: One or more devices is currently being resilvered. The pool will
continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
scan: resilver in progress since Sun Jan 29 13:38:15 2023
12.8G scanned at 692M/s, 492K issued at 25.9K/s, 1.49T total
0B resilvered, 0.00% done, no estimated completion time
config:
NAME STATE READ WRITE CKSUM
zvol0 DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
gpt/sdisk1 ONLINE 0 0 0
replacing-1 DEGRADED 0 0 0
13953654332474917058 UNAVAIL 0 0 0 was /dev/gpt/ndisk1
gpt/sdisk2 ONLINE 0 0 0
errors: No known data errors$ zpool status zvol0
pool: zvol0
state: ONLINE
scan: resilvered 1.49T in 14:11:00 with 0 errors on Mon Jan 30 03:49:15 2023
config:
NAME STATE READ WRITE CKSUM
zvol0 ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
gpt/sdisk1 ONLINE 0 0 0
gpt/sdisk2 ONLINE 0 0 0
errors: No known data errors
$$ zpool list zvol0
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
zvol0 1.81T 1.49T 333G - 3.62T 5% 82% 1.00x ONLINE -
$$ zpool get autoexpand zvol0
NAME PROPERTY VALUE SOURCE
zvol0 autoexpand off default
$$ zpool set autoexpand=on zvol0
$ zpool get autoexpand zvol0
NAME PROPERTY VALUE SOURCE
zvol0 autoexpand on local
$$ zpool list zvol0
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
zvol0 1.81T 1.49T 333G - 3.62T 5% 82% 1.00x ONLINE -
$$ zpool online -e zvol0
missing device name
usage:
online [-e] <pool> <device> ...
$$ zpool online -e zvol0 gpt/sdisk1
$ zpool list zvol0
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
zvol0 5.45T 1.49T 3.97T - - 1% 27% 1.00x ONLINE -
$









host # mkdir -p /jail/minecraft /jail/BASE
host # VER=$( freebsd-version | awk -F '-' '{print $1 "-" $2}' )
host # fetch -o /jail/BASE/${VER}-base.txz https://download.freebsd.org/releases/amd64/14.2-RELEASE/base.txzhost # tar -C /jail/minecraft --unlink -xvf /jail/BASE/14.2-RELEASE-base.txz
host # cp /var/run/dmesg.boot /jail/minecraft/var/run/host # cat /etc/jail.conf
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.consolelog = "/var/log/jail_console_${name}.log";
exec.clean;
mount.devfs;host # cat /etc/jail.conf.d/minecraft.conf
minecraft {
# 全局
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.consolelog = "/var/log/jail_console_${name}.log";
exec.clean;
mount.devfs;
host.hostname = ${name};
path = /jail/${name};
# 自定义
ip4.addr = 10.0.0.210;
interface = em0;
allow.raw_sockets;
allow.sysvipc;
devfs_ruleset=210;
allow.mount;
enforce_statfs=1;
allow.mount.devfs;
allow.mount.procfs;
allow.mount.fdescfs;
}host # grep -A 4 minecraft /etc/devfs.rules
[minecraft=210]
add include $devfsrules_jail
add path 'fd*' unhidehost # service jail onestart minecraft
Starting jails: minecraft.
host # jls
JID IP Address Hostname Path
1 10.0.0.210 minecraft /jail/minecrafthost # jmore
JAIL JID TYPE VER DIR IFACE IP(s)
---- --- ---- --- --- ----- -----
classic - std 13.2-R /jail/classic em0 10.0.0.199
ctld-two - vnet 13.2-R /jail/ctld-two ${if}b -
ctld - vnet 13.2-R /jail/ctld ${if}b -
fbsdjail - std 13.1-R /jail/fbsdjail wlan0 10.0.0.43
iscsi - vnet 13.2-R /jail/iscsi ${if}b -
minecraft 1 std 14.2-R /jail/minecraft em0 10.0.0.210
minio - std 14.0-R /jail/minio em0 10.0.0.133
nfsd - vnet 14.1-R /jail/nfsd ${if}b -
other - std 14.1-R /jail/other em0 10.0.0.199
sambajail - vnet 14.1-R /jail/sambajail ${if}b -
unfs3 - vnet 14.1-R /jail/unfs3 ${if}b -host # grep jail /etc/rc.conf
jail_enable=YES
jail_devfs_enable=YES
jail_list="minecraft"env PS1='minecraft # ' jexec minecraft /bin/shhost # jmore minecraft c
minecraft #minecraft # echo nameserver 1.1.1.1 > /etc/resolv.conf
minecraft # mkdir -p /usr/local/etc/pkg/repos
minecraft # sed -e 's|quarterly|latest|g' /etc/pkg/FreeBSD.conf > /usr/local/etc/pkg/repos/FreeBSD.conf
minecraft # pkg search -o minecraft
games/minecraft-client Client for the block building gameminecraft # pkg install gitup bsddialog ccache portconfig openjdk21 tmux jlessminecraft # gitup ports
(...)
#
# Please review the following file(s) for important changes.
# /usr/ports/UPDATING
# /usr/ports/mail/dspam/files/UPDATING
#
# Done.
minecraft # cd /usr/ports/games/minecraft-server
minecraft # make config
+------------|minecraft-server-1.21.4|--------------+
| 'F1' for Ports Collection help. |
| +---------- RUN [select at least one] ----------+ |
| | new (*) DAEMON Run as a service | |
| | new ( ) STANDALONE Run the .jar file directly | |
| +-----------------------------------------------+ |
| [ OK ] [Cancel] |
+---------------------------------------------------+minecraft # echo DISABLE_LICENSES=yes >> /etc/make.conf
minecraft # env BATCH=yes make build install clean
(...)
When you first run minecraft-server, it will populate the file
/usr/local/etc/minecraft-server/eula.txt
It is required to read the EULA, and then set eula=true
- Configuration files can be found in /usr/local/etc/minecraft-server/
- Log and debug output files can be found in /var/log/minecraft-server/
- World files can be found in /var/db/minecraft-server/
Without daemon option:
- To run the server, run /usr/local/bin/minecraft-server
- To edit java's parameters, edit /usr/local/etc/minecraft-server/java-args.txt
- To run with a specific version of Java, set environment variable JAVA_VERSION,
for example:
export JAVA_VERSION=22
/usr/local/bin/minecraft-server
or:
JAVA_VERSION=22 /usr/local/bin/minecraft-server
With daemon option:
- The service has been installed with the name 'minecraft'
- To adjust maximum memory usage (-Xmx), use minecraft_memx= in /etc/rc.conf
- To adjust initial memory usage (-Xms), use minecraft_mems= in /etc/rc.conf
- To add other java parameters, use minecraft_args= in /etc/rc.conf
- To run with a specific version of Java, use minecraft_java_version= in /etc/rc.conf
- To see the interactive console, type service minecraft console
===> Cleaning for minecraft-server-1.21.4minecraft # cat << FSTAB >> /etc/fstab
fdesc /dev/fd fdescfs rw 0 0
proc /proc procfs rw 0 0
FSTAB
minecraft # echo 'mount -a' >> /etc/rc.local
minecraft # mount -a
minecraft # mount
zroot/jail on / (zfs, local, noatime, nfsv4acls)
devfs on /dev (devfs)
fdescfs on /dev/fd (fdescfs)
procfs on /proc (procfs, local)
devfs on /dev (devfs)minecraft # cat << RC >> /etc/rc.conf
minecraft_enable=YES
minecraft_mems=1024M
minecraft_memx=1024M
RC
minecraft # echo eula=true > /usr/local/etc/minecraft-server/eula.txt
minecraft # cat << MINECRAFT > /usr/local/etc/minecraft-server/server.properties
enable-jmx-monitoring=false
rcon.port=25575
level-seed=
gamemode=survival
enable-command-block=false
enable-query=false
generator-settings={}
enforce-secure-profile=true
level-name=world
motd=FreeBSD Minecraft Server
query.port=25565
pvp=true
generate-structures=true
max-chained-neighbor-updates=1000000
difficulty=easy
network-compression-threshold=256
max-tick-time=60000
require-resource-pack=false
use-native-transport=true
max-players=20
online-mode=false
enable-status=true
allow-flight=false
initial-disabled-packs=
broadcast-rcon-to-ops=true
view-distance=10
server-ip=
resource-pack-prompt=
allow-nether=true
server-port=25565
enable-rcon=false
sync-chunk-writes=true
resource-pack-id=
op-permission-level=4
prevent-proxy-connections=false
hide-online-players=false
resource-pack=
entity-broadcast-range-percentage=100
simulation-distance=10
rcon.password=
player-idle-timeout=0
force-gamemode=false
rate-limit=0
hardcore=false
white-list=false
broadcast-console-to-ops=true
spawn-npcs=true
spawn-animals=true
log-ips=true
function-permission-level=2
initial-enabled-packs=vanilla
level-type=minecraft\:normal
text-filtering-config=
spawn-monsters=true
enforce-whitelist=false
spawn-protection=16
resource-pack-sha1=
max-world-size=29999984
MINECRAFTminecraft # service minecraft start
Starting minecraft.
minecraft # service minecraft status
minecraft is running.
minecraft # sockstat -l4
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
mcserver java 33227 103 tcp4 10.0.0.210:25565 *:*
root syslogd 7809 5 udp4 10.0.0.210:514 *:*minecraft # su mcserver -c '/usr/local/bin/java -Xmx1024M -Xms1024M -jar /usr/local/minecraft-server/server.jar nogui'host # cat /jail/minecraft/usr/local/etc/minecraft-server/usercache.json | tr ',' '\n'
[{"name":"antuan"
"uuid":"0d61326c-dfd1-3fa8-ba9d-249d402fb700"
"expiresOn":"2025-05-05 14:04:15 +0000"}
{"name":"antek"
"uuid":"4b520bac-4b31-3c41-8f9b-2781763e5c88"
"expiresOn":"2025-05-05 09:16:08 +0000"}]
host # jless /jail/minecraft/usr/local/etc/minecraft-server/usercache.json | cat
[
{
"name": "antuan",
"uuid": "0d61326c-dfd1-3fa8-ba9d-249d402fb700",
"expiresOn": "2025-05-05 14:04:15 +0000"
},
{
"name": "antek",
"uuid": "4b520bac-4b31-3c41-8f9b-2781763e5c88",
"expiresOn": "2025-05-05 09:16:08 +0000"
}
]host # jless /jail/minecraft/usr/local/etc/minecraft-server/ops.json | cat
[
{
"uuid": "4b520bac-4b31-3c41-8f9b-2781763e5c88",
"name": "antek",
"level": 4,
"bypassesPlayerLimit": false
},
{
"uuid": "0d61326c-dfd1-3fa8-ba9d-249d402fb700",
"name": "antuan",
"level": 4,
"bypassesPlayerLimit": false
}
]+-------------+ +-------------+
| {primary} | | {secondary} |
| DHCPs1 | ==== HA ==== | DHCPs2 |
| 10.0.10.251 | | 10.0.10.252 |
+-------------+ +-------------+
\ /
+------------------------------------------+
| ADDRESS POOL 10.0.10.x/24 ADDRESS POOL |
+------------------------------------------+
\ /
+----------------+
| {DHCP CLIENTS} |
+----------------+root@DHCPs1:/ # uname -v
FreeBSD 11.2-RELEASE #0 r335510: Fri Jun 22 04:32:14 UTC 2018 [email protected]:/usr/obj/usr/src/sys/GENERIC
root@DHCPs1:/ # gpart show
=> 40 8388528 ada0 GPT (4.0G)
40 1024 1 freebsd-boot (512K)
1064 8386560 2 freebsd-ufs (4.0G)
8387624 944 - free - (472K)
root@DHCPs1:/ # du -smc * | sort -n
0 sys
1 COPYRIGHT
1 dev
1 entropy
1 libexec
1 media
1 mnt
1 net
1 proc
1 root
1 tmp
2 bin
4 etc
7 sbin
8 var
10 rescue
12 lib
128 boot
499 usr
666 totalroot@DHCPs1:~ # top -b -o res
last pid: 15205; load averages: 0.13, 0.25, 0.29 up 0+07:39:11 20:03:48
16 processes: 2 running, 14 sleeping
Mem: 1688K Active, 30M Inact, 26M Wired, 3800K Buf, 32M Free
Swap:
PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND
38897 dhcpd 1 20 0 16424K 10724K select 0:00 0.00% dhcpd
30199 root 1 20 0 13160K 8036K RUN 0:00 0.00% sshd
15106 root 1 28 0 12848K 7136K select 0:00 0.00% sshd
53100 root 1 20 0 9180K 5040K select 0:02 0.00% devd
31079 root 1 20 0 7412K 3640K pause 0:00 0.00% csh
15205 root 1 20 0 7916K 3060K RUN 0:00 0.00% top
15960 root 1 20 0 6464K 2480K nanslp 0:00 0.00% cron
69084 root 1 20 0 6412K 2364K select 0:01 0.00% syslogd
28412 root 1 52 0 6408K 2124K ttyin 0:00 0.00% getty
28188 root 1 52 0 6408K 2124K ttyin 0:00 0.00% getty
28504 root 1 52 0 6408K 2124K ttyin 0:00 0.00% getty
28972 root 1 52 0 6408K 2124K ttyin 0:00 0.00% getty
29736 root 1 52 0 6408K 2124K ttyin 0:00 0.00% getty
29080 root 1 52 0 6408K 2124K ttyin 0:00 0.00% getty
30106 root 1 52 0 6408K 2124K ttyin 0:00 0.00% getty
29392 root 1 52 0 6408K 2124K ttyin 0:00 0.00% getty
`/etc/sysctl.conf` 和 `/boot/loader.conf` 文件不需要修改。
现在你需要安装 ISC DHCP 服务器,由于当前版本是 4.4.x,软件包名相应为 `isc-dhcp44-server`,我们使用命令 `pkg(8)` 来安装。
```sh
root@DHCPs1:/ # pkg update -f -y
The package management tool is not yet installed on your system.
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:11:amd64//quarterly, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done
[nextcloud] Installing pkg-1.10.5...
[nextcloud] Extracting pkg-1.10.5: 100%
Updating FreeBSD repository catalogue...
pkg: Repository FreeBSD load error: access repo file(/var/db/pkg/repo-FreeBSD.sqlite) failed: No such file or directory
[nextcloud] Fetching meta.txz: 100% 944 B 0.9kB/s 00:01
[nextcloud] Fetching packagesite.txz: 100% 6 MiB 530.8kB/s 00:12
Processing entries: 100%
FreeBSD repository update completed. 31134 packages processed.
All repositories are up to date.
root@DHCPs1:/ # echo ?
0
root@DHCPs1:/ #root@DHCPs1:/ # pkg install isc-dhcp44-server
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 1 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
isc-dhcp44-server: 4.4.1_3 [FreeBSD]
Number of packages to be installed: 1
The process will require 6 MiB more space.
Proceed with this action? [y/N]: y
[1/1] Installing isc-dhcp44-server-4.4.1_3...
===> Creating groups.
Creating group 'dhcpd' with gid '136'.
===> Creating users
Creating user 'dhcpd' with uid '136'.
[1/1] Extracting isc-dhcp44-server-4.4.1_3: 100%
Message from isc-dhcp44-server-4.4.1_3:
**** To setup dhcpd, please edit /usr/local/etc/dhcpd.conf.
**** This port installs the dhcp daemon, but doesn't invoke dhcpd by default.
If you want to invoke dhcpd at startup, add these lines to /etc/rc.conf:
dhcpd_enable="YES" # dhcpd enabled?
dhcpd_flags="-q" # command option(s)
dhcpd_conf="/usr/local/etc/dhcpd.conf" # configuration file
dhcpd_ifaces="" # ethernet interface(s)
dhcpd_withumask="022" # file creation mask
**** If compiled with paranoia support (the default), the following rc.conf
options are also supported:
dhcpd_chuser_enable="YES" # runs w/o privileges?
dhcpd_withuser="dhcpd" # user name to run as
dhcpd_withgroup="dhcpd" # group name to run as
dhcpd_chroot_enable="YES" # runs chrooted?
dhcpd_devfs_enable="YES" # use devfs if available?
dhcpd_rootdir="/var/db/dhcpd" # directory to run in
dhcpd_includedir="" # directory with config-
files to include
**** WARNING: never edit the chrooted or jailed dhcpd.conf file but
/usr/local/etc/dhcpd.conf instead which is always copied where
needed upon startup.root@DHCPs1:/ # cat /usr/local/etc/dhcpd.conf
# CORE
failover peer "ha-dhcp" {
primary;
address 10.0.10.251;
port 678;
peer address 10.0.10.252;
peer port 678;
max-response-delay 60;
max-unacked-updates 10;
mclt 3600;
split 128;
load balance max seconds 3;
}
include "/usr/local/etc/dhcpd.conf.SHARED";root@DHCPs1:/ # cat /usr/local/etc/dhcpd.conf.SHARED
# CLIENTS
subnet 10.0.10.0 netmask 255.255.255.0 {
default-lease-time 604800;
max-lease-time 604800;
option routers 10.0.10.254;
option broadcast-address 10.0.10.255;
option subnet-mask 255.255.255.0;
option domain-search "domain.com";
option domain-name-servers 1.1.1.1,9.9.9.9;
pool {
failover peer "ha-dhcp";
range 10.0.10.10 10.0.10.250;
}
}root@DHCPs2:~ # cat /usr/local/etc/dhcpd.conf
# CORE
failover peer "ha-dhcp" {
secondary;
address 10.0.10.252;
port 678;
peer address 10.0.10.251;
peer port 678;
max-response-delay 60;
max-unacked-updates 10;
mclt 3600;
load balance max seconds 3;
}
include "/usr/local/etc/dhcpd.conf.SHARED";root@DHCPs2:/ # cat /usr/local/etc/dhcpd.conf.SHARED
# CLIENTS
subnet 10.0.10.0 netmask 255.255.255.0 {
default-lease-time 604800;
max-lease-time 604800;
option routers 10.0.10.254;
option broadcast-address 10.0.10.255;
option subnet-mask 255.255.255.0;
option domain-search "domain.com";
option domain-name-servers 1.1.1.1,9.9.9.9;
pool {
failover peer "ha-dhcp";
range 10.0.10.10 10.0.10.250;
}
}root@DHCPs1:~ # sysrc dhcpd_enable=YES
dhcpd_enable: -> YES
root@DHCPs1:~ # service isc-dhcpd start
Starting dhcpd.
Internet Systems Consortium DHCP Server 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Config file: /usr/local/etc/dhcpd.conf
Database file: /var/db/dhcpd/dhcpd.leases
PID file: /var/run/dhcpd/dhcpd.pid
Wrote 122 leases to leases file.
Listening on BPF/em0/08:00:27:3c:ab:c8/10.0.10.0/24
Sending on BPF/em0/08:00:27:3c:ab:c8/10.0.10.0/24
Sending on Socket/fallback/fallback-net
failover peer ha-dhcp: I move from normal to startuproot@DHCPs2:~ # sysrc dhcpd_enable=YES
dhcpd_enable: -> YES
root@DHCPs2:~ # service isc-dhcpd onestart
Starting dhcpd.
Internet Systems Consortium DHCP Server 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Config file: /usr/local/etc/dhcpd.conf
Database file: /var/db/dhcpd/dhcpd.leases
PID file: /var/run/dhcpd/dhcpd.pid
Wrote 122 leases to leases file.
Listening on BPF/em0/08:00:27:de:9b:3d/10.0.10.0/24
Sending on BPF/em0/08:00:27:de:9b:3d/10.0.10.0/24
Sending on Socket/fallback/fallback-net
failover peer ha-dhcp: I move from communications-interrupted to startuproot@DHCPc:~ # dhclient em0
DHCPREQUEST on em0 to 255.255.255.255 port 67
DHCPREQUEST on em0 to 255.255.255.255 port 67
DHCPACK from 10.0.10.251
bound to 10.0.10.131 -- renewal in 302119 seconds.root@DHCPc:~ # ifconfig em0
em0: flags=8843 metric 0 mtu 1500
options=9b
ether 08:00:27:d9:45:96
hwaddr 08:00:27:d9:45:96
inet 10.0.10.131 netmask 0xffffff00 broadcast 10.0.10.255
nd6 options=29
media: Ethernet autoselect (1000baseT )
status: activegroup
{
host DHCPc {
hardware ethernet 08:00:27:d9:45:96;
fixed-address 10.0.10.9;
}
}root@DHCPs1:~ # cat /usr/local/etc/dhcpd.conf.SHARED
# CLIENTS
subnet 10.0.10.0 netmask 255.255.255.0 {
default-lease-time 604800;
max-lease-time 604800;
option routers 10.0.10.254;
option broadcast-address 10.0.10.255;
option subnet-mask 255.255.255.0;
option domain-search "domain.com";
option domain-name-servers 1.1.1.1,9.9.9.9;
group
{
host DHCPc {
hardware ethernet 08:00:27:d9:45:96;
fixed-address 10.0.10.9;
}
}
pool {
failover peer "ha-dhcp";
range 10.0.10.10 10.0.10.250;
}
}root@DHCPs1:~ # cat /usr/local/etc/dhcpd.conf.SHARED
# CLIENTS
subnet 10.0.10.0 netmask 255.255.255.0 {
default-lease-time 604800;
max-lease-time 604800;
option routers 10.0.10.254;
option broadcast-address 10.0.10.255;
option subnet-mask 255.255.255.0;
option domain-search "domain.com";
option domain-name-servers 1.1.1.1,9.9.9.9;
group
{
host DHCPc {
hardware ethernet 08:00:27:d9:45:96;
fixed-address 10.0.10.9;
}
}
pool {
failover peer "ha-dhcp";
range 10.0.10.10 10.0.10.250;
}
}root@DHCPc:~ # pkill dhclient
root@DHCPc:~ # service netif restart
root@DHCPc:~ # dhclient em0
DHCPREQUEST on em0 to 255.255.255.255 port 67
DHCPREQUEST on em0 to 255.255.255.255 port 67
DHCPACK from 10.0.10.252
bound to 10.0.10.131 -- renewal in 1665 seconds.
DHCPREQUEST on em0 to 255.255.255.255 port 67
DHCPREQUEST on em0 to 255.255.255.255 port 67
DHCPNAK from 10.0.10.252
DHCPDISCOVER on em0 to 255.255.255.255 port 67 interval 3
DHCPOFFER from 10.0.10.251
DHCPOFFER from 10.0.10.252
DHCPOFFER already seen.
DHCPREQUEST on em0 to 255.255.255.255 port 67
DHCPACK from 10.0.10.252
bound to 10.0.10.9 -- renewal in 302400 seconds.root@DHCPc:~ # ifconfig em0
em0: flags=8843 metric 0 mtu 1500
options=9b
ether 08:00:27:d9:45:96
hwaddr 08:00:27:d9:45:96
inet 10.0.10.9 netmask 0xffffff00 broadcast 10.0.10.255
nd6 options=29
media: Ethernet autoselect (1000baseT )
status: active我在最近的争议中停止了公开发表声明,因为 Eben Moglen 开始在幕后努力“改进”Linux 人在许可证方面的错误,并要求我给他调停,以便他的团队可以工作。老实说,我对这种情况感到非常困扰,因为即使像 Alan Cox 这样的人也在给其他 Linux 开发人员提出违法建议。而且,不同社区之间的互动可能存在更大的潜在风险。
记录一下,我是正确的,Linux 开发人员不能以任何那些 diff 中提出的方式修改许可证,或者在那次对话中(<http://lkml.org/lkml/2007/8/28/157>)。
修改许可证是非法的,除非你是所有者或作者,因为它是一份法律文件。如果有多个所有者或作者,他们必须全都同意。收到双重许可证的人可以以任何一种方式使用该文件……但是,如果他们分发该文件(修改或未修改!),他们必须将其与现有许可证一起分发,因为我们所有人使用的许可证中都有声明,称许可证不得删除。
可能看起来许可证允许以任何一种许可证来“分发”它,但这种对许可证的解释是错误的——依然非法地拆分、切割或修改他人的法律文件,且不能被另一个许可证替换,因为它不能被删除。因此,双重许可证的文件在每次分发时始终保持双重许可证。
现在,我已经够善意,给了 Eben 和他的团队几天时间在 Linux 社区内部进行沟通,以说服他们所提出和讨论的东西在法律层面上是错误的。我认为 Eben 也同意我的看法,在伦理和社区层面上,这引起了严重的担忧(某种程度上,Linux 开发人员需要有一种共同的伦理与 *BSD 开发人员合作)。而且撰写应用程序的更大开源社区也可能面临类似问题。
到目前为止,Eben 还选择不发表公开声明,但由于时间正在消磨人们的记忆,我现在发表一个(声明)。而且,我觉得很多 Linux 的“重新许可”舆论攻击我非常不公平,所以我不会等 Eben 公开发表关于这个问题的声明。
在 <http://lkml.org/lkml/2007/8/29/183> 中,Alan Cox 成功地总结了 Jiri Slaby 和 Luis Rodriguez 试图通过修改未经所有作者同意的双许可证文件所提出的内容。Alan 问:“所以问题是什么?”嗯,Alan,我必须警告你——你的帖子正在建议人们违法。
我将尝试简单地描述,基于我所学到的知识,如何处理这样的许可证:
- 如果你收到双许可证的代码,你不能删除你不喜欢的许可证然后再分发它。它必须保留,因为你不能编辑他人的许可证——这是一份由三部分组成的法律文件(例如:版权声明、BSD 许可证,后跟 GPL)。
- 如果你收到 ISC 或 BSD 许可证的代码,你不能删除许可证。原理相同,因为声明是如此。这是法律。真的。
- 如果你向代码添加了“大量的原创内容”,这些内容本身在版权保护范围内,你可以选择在现有许可证上方放置一个不同且独立(必须不冲突……)的许可证。
(警告:随着许可证组合意义的变得不那么明确——这也涉及道德陷阱)。
- 如果你希望每个人保持友好,你应该还代码。
这意味着(在某种伦理或友好的层面上),你可能不想在 BSD 或 ISC 文件的顶部放置 GPL,因为这将告诉编写 BSD 或 ISC 文件的人:
“感谢你写的东西,但这是单行道,你给我们代码,我们拿走,我们不给你任何东西。滚开。”
无论哪种情况,我认为在 BSD 世界中我们得到了一堂有价值的课——有很多很多喜欢 GPL 的人会尝试找到任何办法来不给予回馈和分享(我将提及一个名字:Luis Rodriguez 一直狂热地推动我们使用双许可证,我觉得他应该对这个特定问题负责)。许多同样的人多年来一直在说 BSD 代码可以被窃取,这就是为什么人们应该将代码 GPL 化。
好吧,他们真正教给我们的教训是,他们认为 GPL 是他们从我们这里拿走东西的最好工具!
GPL 的拥护者说,我们将面临的巨大问题是公司将拿走我们的 BSD 代码,对其进行修改,然后不给予回馈。不,我们面临
的真正问题是,人们将 GPL 包装在我们的代码周围,并以与这些所谓的公司相同的方式锁定我们。就像 Linux 社区一样,我们有许多公司一直在不断地给我们回馈代码。但是一旦代码被 GPL 化,我们就无法将其拿回。
这具有讽刺意味。
我希望 GPL 社区中的一些人能好好考虑一下。你的许可证可能对你有利,但你可能会失去所需的朋友。GPL 用户有机会“发展社区”,保持共享伦理活跃。
如果 Linux 开发人员在我们辛勤工作的代码周围加上 GPL,那肯定不会被视为社区发展。
感谢你考虑这个问题。
[我请求确保有个副本发到 Linux 内核邮件列表上]

host # beadm list
BE Active Mountpoint Space Created
13.0.w520 NR / 12.8G 2021-09-14 17:27
13.0.w520.safe - - 1.2G 2021-10-18 10:01
host # zfs list -r zroot/ROOT
NAME USED AVAIL REFER MOUNTPOINT
zroot/ROOT 12.8G 96.8G 88K none
zroot/ROOT/13.0.w520 12.8G 96.8G 11.6G /
zroot/ROOT/13.0.w520.safe 8K 96.8G 11.1G /
host # zfs create -o mountpoint=/ -o canmount=off zroot/ROOT/12.3
host # beadm list
BE Active Mountpoint Space Created
13.0.w520 NR / 12.8G 2021-09-14 17:27
13.0.w520.safe - - 1.2G 2021-10-18 10:01
12.3 - - 96.0K 2021-10-18 13:14host # beadm mount 12.3 /var/tmp/12.3
Mounted successfully on '/var/tmp/12.3'
host # beadm list
BE Active Mountpoint Space Created
13.0.w520 NR / 12.8G 2021-09-14 17:27
13.0.w520.safe - - 1.2G 2021-10-18 10:01
12.3 - /var/tmp/12.3 96.0K 2021-10-18 13:14
host # curl -o - https://download.freebsd.org/ftp/snapshots/amd64/12.3-PRERELEASE/base.txz \
| tar --unlink -xpf - -C /var/tmp/12.3
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 173M 100 173M 0 0 1889k 0 0:01:33 0:01:33 --:--:-- 2228k
host # exa -1 /var/tmp/12.3
bin
boot
dev
etc
lib
libexec
media
mnt
net
proc
rescue
root
sbin
tmp
usr
var
COPYRIGHT
sys
host # curl -o - https://download.freebsd.org/ftp/snapshots/amd64/12.3-PRERELEASE/kernel.txz \
| tar --unlink -xpf - -C /var/tmp/12.3
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 43.3M 100 43.3M 0 0 1733k 0 0:00:25 0:00:25 --:--:-- 1663k
host # exa -lh /var/tmp/12.3/boot/kernel/kernel
Permissions Size User Date Modified Name
.r-xr-xr-x 37M root 2021-10-14 06:31 /var/tmp/12.3/boot/kernel/kernel
host # curl -o - https://download.freebsd.org/ftp/snapshots/amd64/12.3-PRERELEASE/lib32.txz \
| tar --unlink -xpf - -C /var/tmp/12.3
host # exa -ld /var/tmp/12.3/usr/lib32
drwxr-xr-x - root 2021-10-18 13:45 /var/tmp/12.3/usr/lib32host # pkg prime-list > /var/tmp/12.3/pkg.prime-list
host # chroot /var/tmp/12.3 /bin/sh
(BE) # export PS1="BE # "
BE # mount -t devfs devfs /dev
BE # sed -i '' s/quarterly/latest/g /etc/pkg/FreeBSD.conf
BE # pkg install -y $( cat pkg.prime-list )
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:12:amd64/latest, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done
Installing pkg-1.17.2...
Extracting pkg-1.17.2: 100%
Updating FreeBSD repository catalogue...
Fetching meta.conf: 100% 163 B 0.2kB/s 00:01
Fetching packagesite.pkg: 100% 6 MiB 1.3MB/s 00:05
Processing entries: 100%
FreeBSD repository update completed. 31294 packages processed.
All repositories are up to date.
Updating database digests format: 100%
pkg: No packages available to install matching 'chromium' have been found in the repositories
pkg: No packages available to install matching 'drm-fbsd13-kmod' have been found in the repositories
pkg: No packages available to install matching 'geany-gtk2' have been found in the repositories
pkg: No packages available to install matching 'ramspeed' have been found in the repositories
pkg: No packages available to install matching 'vim-console' have been found in the repositoriesBE # sed -i '' \
-e s/drm-fbsd13-kmod/drm-kmod/g \
-e s/geany-gtk2/geany/g \
-e s/vim-console/vim-tiny/g \
pkg.prime-list
BE # pkg install -y $( cat pkg.prime-list | grep -v -e chromium -e ramspeed )
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1072 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
(...)
Number of packages to be installed: 1072
The process will require 11 GiB more space.
2 GiB to be downloaded.
(...)
BE # rm pkg.prime-listBE # pkg stats
Local package database:
Installed packages: 1073
Disk space occupied: 11 GiB
Remote package database(s):
Number of repositories: 1
Packages available: 31294
Unique packages: 31294
Total size of packages: 96 GiBhost # for I in /boot/loader.conf \
/etc/ttys \
/etc/rc.conf \
/etc/rc.local \
/etc/sysctl.conf \
/etc/hosts \
/etc/ethers \
/etc/fstab \
/etc/jail.conf \
/etc/make.conf \
/etc/src.conf \
/etc/devfs.rules \
/etc/exports \
/etc/resolv.conf \
/etc/localtime \
/etc/pf.conf \
/etc/resolv.conf \
/etc/profile \
/etc/csh.cshrc \
/etc/wpa_supplicant.conf \
/etc/freebsd-update.conf \
/etc/motd.template \
/etc/motd \
/var/cron/tabs/*
do
cp "${I}" /var/tmp/12.3/"${I}"
echo "${I}"
done
/boot/loader.conf
/etc/ttys
/etc/rc.conf
/etc/rc.local
/etc/sysctl.conf
/etc/hosts
/etc/ethers
/etc/fstab
/etc/jail.conf
/etc/make.conf
/etc/src.conf
/etc/devfs.rules
/etc/localtime
/etc/pf.conf
/etc/resolv.conf
/etc/profile
/etc/csh.cshrc
/etc/wpa_supplicant.conf
/etc/freebsd-update.conf
/etc/motd.template
/etc/motd
/var/cron/tabs/vermaden
/var/cron/tabs/roothost # for I in /usr/local/etc/X11/xdm/Xresources \
/usr/local/etc/X11/xdm/Xsetup_0 \
/usr/local/etc/X11/xorg.conf.d/* \
/usr/local/etc/devd/* \
/usr/local/etc/automount.conf \
/usr/local/etc/sudoers \
/usr/local/etc/doas.conf \
/usr/local/etc/zshrc \
/usr/local/etc/smb4.conf \
/usr/local/etc/automount.conf \
/usr/local/etc/fscd.conf \
/usr/local/etc/cups/* \
/usr/local/etc/cups/ssl/* \
/usr/local/etc/cups/ppd/*
do
cp "${I}" /var/tmp/12.3/"${I}"
echo "${I}"
done
/usr/local/etc/X11/xdm/Xresources
/usr/local/etc/X11/xdm/Xsetup_0
/usr/local/etc/X11/xorg.conf.d/card.conf
/usr/local/etc/X11/xorg.conf.d/flags.conf
/usr/local/etc/X11/xorg.conf.d/keyboard.conf
/usr/local/etc/X11/xorg.conf.d/touchpad.conf
/usr/local/etc/devd/audio_source.conf
/usr/local/etc/devd/automount_devd.conf
/usr/local/etc/devd/cups.conf
/usr/local/etc/devd/cups.conf.sample
/usr/local/etc/devd/webcamd.conf
/usr/local/etc/automount.conf
/usr/local/etc/sudoers
/usr/local/etc/doas.conf
/usr/local/etc/zshrc
/usr/local/etc/smb4.conf
/usr/local/etc/automount.conf
/usr/local/etc/fscd.conf
/usr/local/etc/cups/classes.conf
/usr/local/etc/cups/command.types
/usr/local/etc/cups/cups-browsed.conf
/usr/local/etc/cups/cups-browsed.conf.sample
/usr/local/etc/cups/cups-files.conf
/usr/local/etc/cups/cups-files.conf.sample
/usr/local/etc/cups/cupsd.conf
/usr/local/etc/cups/cupsd.conf.sample
/usr/local/etc/cups/ppd
/usr/local/etc/cups/printers.conf
/usr/local/etc/cups/printers.conf.O
/usr/local/etc/cups/snmp.conf
/usr/local/etc/cups/snmp.conf.sample
/usr/local/etc/cups/ssl
/usr/local/etc/cups/ppd/HP-M251nw.ppd
/usr/local/etc/cups/ppd/Samsung-ML-1915.ppdBE # pw useradd vermaden -u 1000 -d /home/vermaden -G wheel,operator,video,network,webcamd,vboxusers
BE # passwd root
BE # passwd vermadenBE # exit
host # umount /var/tmp/12.3/dev
host # beadm unmount 12.3
Unmounted successfully
host # beadm list -D
BE Active Mountpoint Space Created
13.0.w520 NR / 11.3G 2021-09-14 17:27
13.0.w520.safe - - 11.1G 2021-10-18 10:01
12.3 - - 9.5G 2021-10-18 13:14
host # shutdown -r now# zpool import data
This pool uses the following feature(s) not supported by this system:
org.freebsd:zstd_compress (zstd compression algorithm support.)
com.delphix:log_spacemap (Log metaslab changes on a single spacemap and flush them periodically.)
org.zfsonlinux:project_quota (space/object accounting based on project ID.)
org.zfsonlinux:userobj_accounting (User/Group object accounting.)
cannot import 'data': unsupported version or feature# pkg install -y openzfs openzfs-kmod
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 2 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
openzfs: 2021090800
openzfs-kmod: 2021090800
Number of packages to be installed: 2
The process will require 22 MiB more space.
4 MiB to be downloaded.
[1/2] Fetching openzfs-2021090800.pkg: 100% 3 MiB 975.3kB/s 00:03
[2/2] Fetching openzfs-kmod-2021090800.pkg: 100% 1 MiB 591.2kB/s 00:02
Checking integrity... done (0 conflicting)
[1/2] Installing openzfs-kmod-2021090800...
[1/2] Extracting openzfs-kmod-2021090800: 100%
pkg: Cannot open /dev/null:No such file or directory
[2/2] Installing openzfs-2021090800...
[2/2] Extracting openzfs-2021090800: 100%
=====
Message from openzfs-kmod-2021090800:
--
Amend /boot/loader.conf as follows to use this module:
- change zfs_load="YES" to NO
- change opensolaris_load="YES" to NO
- add openzfs_load="YES"
- (for ARM64) add cryptodev_load="YES"
=====
Message from openzfs-2021090800:
--
Ensure that any zfs-related commands, such as zpool, zfs, as used in scripts
and in your terminal sessions, use the correct path of /usr/local/sbin/ and
not the /sbin/ commands provided by the FreeBSD base system.
Consider setting this in your shell profile defaults!host # beadm mount 12.3 /var/tmp/12.3
Mounted successfully on '/var/tmp/12.3'
host # chroot /var/tmp/12.3
BE # cp /boot/loader.conf /boot/loader.conf.ZFS
BE # vi /boot/loader.conf
BE # diff -u /boot/loader.conf.ZFS /boot/loader.conf
--- /boot/loader.conf.ZFS 2021-10-19 10:57:04.180732000 +0000
+++ /boot/loader.conf 2021-10-19 10:57:23.992145000 +0000
@@ -12,7 +12,8 @@
# 启动模块
geom_eli_load=YES
- zfs_load=YES
+ zfs_load=NO
+ openzfs_load=YES
# 为磁盘禁用 /dev/diskid/*
kern.geom.label.disk_ident.enable=0
BE # shutdown -r nowhost # gpart show -p ada1
=> 40 250069600 ada1 GPT (119G)
40 409600 ada1p1 efi (200M) <== UEFI BOOT PARTITION
409640 1024 ada1p2 freebsd-boot (512K) <== BIOS BOOT PARTITION
410664 984 - free - (492K)
411648 2097152 ada1p3 freebsd-swap (1.0G)
2508800 247560192 ada1p4 freebsd-zfs (118G)
250068992 648 - free - (324K)
host # mount_msdosfs /dev/ada1p1 /mnt
host # cp /var/tmp/13.1/boot/loader.efi /mnt/efi/boot/bootx64.efihost # cd /var/tmp/13.1/boot
host # pwd
/var/tmp/13.1/boot
host # gpart bootcode -b ./pmbr -p ./gptzfsboot -i 2 ada1
partcode written to ada1p2
bootcode written to ada1

$ gpart create -s gpt da1
da1 created
$ gpart create -s gpt da2
da2 created
$ gpart add -t freebsd-zfs -a 4k -s 4g -l tt1 da1
da1p1 added
$ gpart add -t freebsd-zfs -a 4k -s 4g -l tt2 da2
da2p1 added
$
$ gpart show da1
=> 40 488397088 da1 GPT (233G)
40 8388608 1 freebsd-zfs (4.0G)
8388648 480008480 - free - (229G)
$ gpart show da2
=> 40 312581728 da2 GPT (149G)
40 8388608 1 freebsd-zfs (4.0G)
8388648 304193120 - free - (145G)
$ gpart show -l da1
=> 40 488397088 da1 GPT (233G)
40 8388608 1 tt1 (4.0G)
8388648 480008480 - free - (229G)
$ gpart show -l da2
=> 40 312581728 da2 GPT (149G)
40 8388608 1 tt2 (4.0G)
8388648 304193120 - free - (145G)
$$ zpool create -O atime=off ztest mirror gpt/tt1 gpt/tt2
$$ zpool status ztest
pool: ztest
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
ztest ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
gpt/tt1 ONLINE 0 0 0
gpt/tt2 ONLINE 0 0 0
errors: No known data errors
$ zpool list -v ztest
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
ztest 3.75G 3.62G 128M - - 72% 96% 1.00x ONLINE -
mirror-0 3.75G 3.62G 128M - - 72% 96.7% - ONLINE
gpt/tt1 - - - - - - - - ONLINE
gpt/tt2 - - - - - - - - ONLINE
$ zfs list ztest
NAME USED AVAIL REFER MOUNTPOINT
ztest 420K 3.62G 96K /ztest
$ df /ztest/
Filesystem 512-blocks Used Avail Capacity Mounted on
ztest 7601576 192 7601384 0% /ztest$ dd if=/dev/zero of=/ztest/dummy bs=1m
dd: /ztest/dummy: No space left on device
3711+0 records in
3710+1 records out
3891134464 bytes transferred in 151.249101 secs (25726662 bytes/sec)
$ df -h /ztest/
Filesystem Size Used Avail Capacity Mounted on
ztest 3.6G 3.6G 0B 100% /ztest
$ zfs list -o space ztest
NAME AVAIL USED USEDSNAP USEDDS USEDREFRESERV USEDCHILD
ztest 0B 3.63G 0B 3.62G 0B 672K
$ ls -l /ztest/dummy
-rw-r--r-- 1 root wheel 3891134464 Dec 22 17:43 /ztest/dummy$ zpool export ztest
$ ls -l /boot/kernel/kernel
-r-xr-xr-x 2 root wheel 29343392 Nov 4 10:27 /boot/kernel/kernel
$ dd if=/boot/kernel/kernel of=/dev/gpt/tt1 oseek=1000000
dd: /dev/gpt/tt1: Invalid argument
57311+1 records in
57311+0 records out
29343232 bytes transferred in 21.647581 secs (1355497 bytes/sec)
$$ zpool import
pool: ztest
id: 6304409293823647838
state: DEGRADED
status: One or more devices are missing from the system.
action: The pool can be imported despite missing or damaged devices. The
fault tolerance of the pool may be compromised if imported.
see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-2Q
config:
ztest DEGRADED
mirror-0 DEGRADED
gpt/tt1 ONLINE
gpt/tt2 UNAVAIL cannot open$ zpool import ztest
$ zpool status ztest
pool: ztest
state: DEGRADED
status: One or more devices could not be opened. Sufficient replicas exist for
the pool to continue functioning in a degraded state.
action: Attach the missing device and online it using 'zpool online'.
see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-2Q
config:
NAME STATE READ WRITE CKSUM
ztest DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
gpt/tt1 ONLINE 0 0 0
13953643250226400519 UNAVAIL 0 0 0 was /dev/gpt/tt2
errors: No known data errors
$ df /ztest
Filesystem 512-blocks Used Avail Capacity Mounted on
ztest 7601264 7601024 240 100% /ztest
$ ls /ztest
dummy$ hd /ztest/dummy
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
hd: /ztest/dummy: Input/output error
9e1a0000
$$ zpool export ztest$ zpool import
pool: ztest
id: 6304409293823647838
state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:
ztest ONLINE
mirror-0 ONLINE
gpt/tt1 ONLINE
gpt/tt2 ONLINE$ zpool import ztest
$ zpool status ztest
pool: ztest
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
ztest ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
gpt/tt1 ONLINE 0 0 0
gpt/tt2 ONLINE 0 0 0
errors: No known data errors
$$ hd /ztest/dummy
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
e7ee0000
$$ zpool status ztest
pool: ztest
state: ONLINE
scan: resilvered 432K in 00:00:01 with 0 errors on Fri Dec 23 11:14:23 2022
config:
NAME STATE READ WRITE CKSUM
ztest ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
gpt/tt1 ONLINE 0 0 0
gpt/tt2 ONLINE 0 0 0
errors: No known data errors
$$ zpool scrub ztest
$ zpool status ztest
pool: ztest
state: ONLINE
scan: scrub in progress since Fri Dec 23 11:18:02 2022
3.62G scanned at 530M/s, 378M issued at 54.0M/s, 3.62G total
0B repaired, 10.18% done, 00:01:01 to go
config:
NAME STATE READ WRITE CKSUM
ztest ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
gpt/tt1 ONLINE 0 0 0
gpt/tt2 ONLINE 0 0 0
errors: No known data errors$ zpool status ztest
pool: ztest
state: ONLINE
status: One or more devices has experienced an unrecoverable error. An
attempt was made to correct the error. Applications are unaffected.
action: Determine if the device needs to be replaced, and clear the errors
using 'zpool clear' or replace the device with 'zpool replace'.
see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-9P
scan: scrub repaired 15.8M in 00:01:06 with 0 errors on Fri Dec 23 11:19:08 2022
config:
NAME STATE READ WRITE CKSUM
ztest ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
gpt/tt1 ONLINE 0 0 130
gpt/tt2 ONLINE 0 0 0
errors: No known data errors$ zpool export ztest
$ zpool import ztest
$ hd /ztest/dummy
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
e7ee0000
$$ zpool create -O atime=off ztest mirror gpt/tt1 gpt/tt2
$ dd if=/dev/zero of=/ztest/dummy bs=1m
dd: /ztest/dummy: No space left on device
3711+0 records in
3710+1 records out
3891134464 bytes transferred in 153.170356 secs (25403966 bytes/sec)
$ zpool export ztest
$ dd if=/boot/kernel/kernel of=/dev/gpt/tt1 oseek=1000000
dd: /dev/gpt/tt1: Invalid argument
57311+1 records in
57311+0 records out
29343232 bytes transferred in 21.643263 secs (1355767 bytes/sec)
$ zpool import ztest
$ zpool scrub ztest
$ zpool status ztest
pool: ztest
state: ONLINE
status: One or more devices has experienced an unrecoverable error. An
attempt was made to correct the error. Applications are unaffected.
action: Determine if the device needs to be replaced, and clear the errors
using 'zpool clear' or replace the device with 'zpool replace'.
see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-9P
scan: scrub repaired 27.9M in 00:01:06 with 0 errors on Mon Dec 26 10:55:49 2022
config:
NAME STATE READ WRITE CKSUM
ztest ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
gpt/tt1 ONLINE 0 0 227
gpt/tt2 ONLINE 0 0 0
errors: No known data errors
$ zpool export ztest$ zpool import
pool: ztest
id: 11275383091719095959
state: DEGRADED
status: One or more devices are missing from the system.
action: The pool can be imported despite missing or damaged devices. The
fault tolerance of the pool may be compromised if imported.
see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-2Q
config:
ztest DEGRADED
mirror-0 DEGRADED
gpt/tt1 ONLINE
gpt/tt2 UNAVAIL cannot open
$ zpool import ztest
$ hd /ztest/dummy
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
e7ee0000
$ zpool export ztest$ zpool import ztest
$ zpool status ztest
pool: ztest
state: ONLINE
scan: scrub repaired 27.9M in 00:01:06 with 0 errors on Mon Dec 26 10:55:49 2022
config:
NAME STATE READ WRITE CKSUM
ztest ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
gpt/tt1 ONLINE 0 0 0
gpt/tt2 ONLINE 0 0 0
errors: No known data errors
$















zpool import -o readonly mypoolzpool import -D mypoolzfs groupspace mypool/projectXzfs destroy -v mypool@%bzpool create mypool disk1zpool create mystripe disk1 disk2zpool create mymirror mirror disk1 disk2zpool create paritypool raidz disk1 disk2 disk3zpool create myraidz2 raidz2 disk1 disk2 disk3 disk4zpool create myr10 mirror disk1 disk2 mirror disk3 disk4zpool create myz3 raidz3 disk1 disk2 disk3 disk4 disk5zpool statuszpool listzpool iostatzpool historyzpool getzpool add mypool cache /dev/nda0zpool add mypool log /dev/nda1zpool add mypool spare /dev/nda2zpool attach mypool mirror /dev/nda0 /dev/nda1zpool replace mypool /dev/nda2 /dev/nda3zpool export mypoolzpool importzpool import mypoolzpool import oldname newnamezpool create test disk1zfs create mypool/dszfs create -p mypool/home/fredzfs listzfs list mypool/dszfs list -r mypool/dszfs list -d 1 mypool/homezfs list -o name mypool/homezfs list -Ho name mypool/homezfs list -o used,avail,refer,namezfs list -rs refer mypool/homezfs list -rS refer mypool/homezfs list -o spacezfs rename mypool/home/fred mypool/home/evazfs destroy -nv mypool/oldwould destroy mypool/oldzfs destroy -v mypool/oldwill destroy mypool/oldzfs destroy -r mypool/testdatazpool get all mypoolzfs get all mypool/datasetzpool get capacity mypoolzfs set atime=off mypoolzfs set mountpoint=/media mypool/dszfs set warranty:expires=2048/04/20 mypoolzfs get warranty:expires mypoolzfs inherit warranty:expires mypoolzpool scrub mypoolzpool statuszfs create -V 10G mypool/vol1zfs create -V 1P -s mypool/sparse1PBvolzfs set quota=10G mypool/datasetzfs set refquota=10G mypool/datasetzfs set userquota@fred=10G mypool/home/fredzfs set groupquota@projectX=100G mypool/projectXzfs get quota mypool/datasetzfs get refquota mypool/home/fredzfs userspace mypool/home/fredzfs set quota=none mypool/home/fredzfs set reservation=100G mypool/homezfs set refreservation=10G mypool/home/evezfs get reservation mypool/home/evezfs list -o spacezfs set reservation=none mypool/home/evezfs snapshot mypool/ds@mysnapshotzfs snap mypool/ds@mysnapshotzfs snap -r mypool/ds@mysnapshotzfs list -t snap mypool/dszfs list -rt snap mypool/dszfs list -rt all -o name,used,refer,written mypoolzfs diff mypool/ds@backupzfs diff mypool/ds@backup1 mypool/ds@backup2zfs rollback mypool/ds@backup2zfs rollback -r mypool/ds@backup1mount -t zfs mypool/ds@backup /mnt/backupzfs destroy -vn mypool/ds@backupzfs destroy -v mypool/ds@backupzfs destroy -rv mypool/ds@backupmypool@a
mypool@b
mypool@c
mypool@d
mypool@e zfs destroy -v mypool@b%dzfs destroy -v mypool@b%zfs hold keepme mypool/home@importantzfs holds -r mypool/home@importantzfs release keepme mypool/home@importantzfs clone mypool/ds@backup mypool/myclonezfs get origin mypool/myclonezfs promote mypool/myclonezfs destroy mypool/myclonezfs create -o encryption=on -o keyformat=passphrase -o keylocation=prompt mypool/secretzfs get keystatus mypool/secretzfs load-key mypool/secretzfs allow -u joe atime mypool/datasetzfs allow mypool/datasetzfs unallow -u joe compression mypool/datasetzfs allow -g mygroup atime mypool/datasetzfs allow -u jill allow mypool/datasetzfs allow -s @myset mount,snapshot,rollback,destroy mypool/datasetzfs allow -u jill @myset mypool/datasetzfs send mypool/ds@backup > dsbackupzfs send -v mypool/ds@backup > targetzfs recv mypool/backup < dsbackupzfs recv -v mypool/backup < dsbackupzfs send mypool/ds@backup | zfs recv mypool/newzfs send poolA/ds@backup | ssh host zfs recv poolB/newzfs allow -u sender send,snapshot mypool/sourcezfs allow -u receiver compression,mountpoint,mount,create,receive mypool/destinationzpool import -R /media mypoolzpool get capacity,health mypoolzfs inherit -r warranty:expires mypool% pkg info | wc -l
1051% chrome
Shared object "libx264.so.155" not found, required by "libavcodec.so.58"# pkg upgrade
# pkg-recompile.sh build% which chrome
/usr/local/bin/chrome
% ldd /usr/local/bin/chrome
ldd: /usr/local/bin/chrome: not a dynamic executable% cat /usr/local/bin/chrome
#!/bin/sh
SYSCTL=kern.ipc.shm_allow_removed
if [ "`/sbin/sysctl -n $SYSCTL`" = 0 ] ; then
cat << EOMSG
For correct operation, shared memory support has to be enabled
in Chromium by performing the following command as root :
sysctl $SYSCTL=1
To preserve this setting across reboots, append the following
to /etc/sysctl.conf :
$SYSCTL=1
EOMSG
exit 1
fi
ulimit -c 0
exec /usr/local/share/chromium/chrome ${1+"$@"}% ldd /usr/local/share/chromium/chrome
/usr/local/share/chromium/chrome:
libthr.so.3 => /lib/libthr.so.3 (0x809b78000)
libX11.so.6 => /usr/local/lib/libX11.so.6 (0x809da0000)
libX11-xcb.so.1 => /usr/local/lib/libX11-xcb.so.1 (0x80a0df000)
libxcb.so.1 => /usr/local/lib/libxcb.so.1 (0x80a2e0000)
libXcomposite.so.1 => /usr/local/lib/libXcomposite.so.1 (0x80a506000)
libXcursor.so.1 => /usr/local/lib/libXcursor.so.1 (0x80a708000)
libXdamage.so.1 => /usr/local/lib/libXdamage.so.1 (0x80a913000)
libXext.so.6 => /usr/local/lib/libXext.so.6 (0x80ab15000)
libXfixes.so.3 => /usr/local/lib/libXfixes.so.3 (0x80ad26000)
libXi.so.6 => /usr/local/lib/libXi.so.6 (0x80af2b000)
libXrender.so.1 => /usr/local/lib/libXrender.so.1 (0x80b139000)
libXtst.so.6 => /usr/local/lib/libXtst.so.6 (0x80b342000)
libgmodule-2.0.so.0 => /usr/local/lib/libgmodule-2.0.so.0 (0x80b547000)
libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x80b74a000)
libgobject-2.0.so.0 => /usr/local/lib/libgobject-2.0.so.0 (0x80ba61000)
libgthread-2.0.so.0 => /usr/local/lib/libgthread-2.0.so.0 (0x80bcab000)
libintl.so.8 => /usr/local/lib/libintl.so.8 (0x80beac000)
libnss3.so => /usr/local/lib/nss/libnss3.so (0x80c0b7000)
libsmime3.so => /usr/local/lib/nss/libsmime3.so (0x80c3e3000)
libnssutil3.so => /usr/local/lib/nss/libnssutil3.so (0x80c60d000)
libplds4.so => /usr/local/lib/libplds4.so (0x80c83d000)
libplc4.so => /usr/local/lib/libplc4.so (0x80ca40000)
libnspr4.so => /usr/local/lib/libnspr4.so (0x80cc44000)
libdl.so.1 => /usr/lib/libdl.so.1 (0x80ce83000)
libcups.so.2 => /usr/local/lib/libcups.so.2 (0x80d084000)
libxml2.so.2 => /usr/local/lib/libxml2.so.2 (0x80d315000)
libfontconfig.so.1 => /usr/local/lib/libfontconfig.so.1 (0x80d6a8000)
libdbus-1.so.3 => /usr/local/lib/libdbus-1.so.3 (0x80d8ef000)
libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x80db40000)
libkvm.so.7 => /lib/libkvm.so.7 (0x80dd43000)
libutil.so.9 => /lib/libutil.so.9 (0x80df51000)
libXss.so.1 => /usr/local/lib/libXss.so.1 (0x80e165000)
libwebpdemux.so.2 => /usr/local/lib/libwebpdemux.so.2 (0x80e367000)
libwebpmux.so.3 => /usr/local/lib/libwebpmux.so.3 (0x80e56b000)
libwebp.so.7 => /usr/local/lib/libwebp.so.7 (0x80e775000)
libfreetype.so.6 => /usr/local/lib/libfreetype.so.6 (0x80ea05000)
libjpeg.so.8 => /usr/local/lib/libjpeg.so.8 (0x80ecbb000)
libexpat.so.1 => /usr/local/lib/libexpat.so.1 (0x80ef4e000)
libharfbuzz.so.0 => /usr/local/lib/libharfbuzz.so.0 (0x80f179000)
libdrm.so.2 => /usr/local/lib/libdrm.so.2 (0x80f458000)
libXrandr.so.2 => /usr/local/lib/libXrandr.so.2 (0x80f66b000)
libgio-2.0.so.0 => /usr/local/lib/libgio-2.0.so.0 (0x80f875000)
libavcodec.so.58 => /usr/local/lib/libavcodec.so.58 (0x80fe00000)
libavformat.so.58 => /usr/local/lib/libavformat.so.58 (0x811800000)
libavutil.so.56 => /usr/local/lib/libavutil.so.56 (0x811c52000)
libopenh264.so.4 => /usr/local/lib/libopenh264.so.4 (0x811eca000)
libasound.so.2 => /usr/local/lib/libasound.so.2 (0x8121da000)
libsnappy.so.1 => /usr/local/lib/libsnappy.so.1 (0x8124de000)
libopus.so.0 => /usr/local/lib/libopus.so.0 (0x8126e6000)
libpangocairo-1.0.so.0 => /usr/local/lib/libpangocairo-1.0.so.0 (0x812956000)
libpango-1.0.so.0 => /usr/local/lib/libpango-1.0.so.0 (0x812b63000)
libcairo.so.2 => /usr/local/lib/libcairo.so.2 (0x812db1000)
libGL.so.1 => /usr/local/lib/libGL.so.1 (0x8130d8000)
libpci.so.3 => /usr/local/lib/libpci.so.3 (0x813366000)
libatk-1.0.so.0 => /usr/local/lib/libatk-1.0.so.0 (0x813571000)
libatk-bridge-2.0.so.0 => /usr/local/lib/libatk-bridge-2.0.so.0 (0x81379c000)
libatspi.so.0 => /usr/local/lib/libatspi.so.0 (0x8139cc000)
libFLAC.so.8 => /usr/local/lib/libFLAC.so.8 (0x813bfd000)
libgtk-3.so.0 => /usr/local/lib/libgtk-3.so.0 (0x814000000)
libgdk-3.so.0 => /usr/local/lib/libgdk-3.so.0 (0x8148b9000)
libcairo-gobject.so.2 => /usr/local/lib/libcairo-gobject.so.2 (0x814bb0000)
libgdk_pixbuf-2.0.so.0 => /usr/local/lib/libgdk_pixbuf-2.0.so.0 (0x814db8000)
libxslt.so.1 => /usr/local/lib/libxslt.so.1 (0x814fdb000)
libz.so.6 => /lib/libz.so.6 (0x815218000)
liblzma.so.5 => /usr/lib/liblzma.so.5 (0x815430000)
libm.so.5 => /lib/libm.so.5 (0x815659000)
librt.so.1 => /usr/lib/librt.so.1 (0x815886000)
libc++.so.1 => /usr/lib/libc++.so.1 (0x815a8c000)
libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x815d5a000)
libc.so.7 => /lib/libc.so.7 (0x800823000)
libXau.so.6 => /usr/local/lib/libXau.so.6 (0x815f79000)
libXdmcp.so.6 => /usr/local/lib/libXdmcp.so.6 (0x81617c000)
libiconv.so.2 => /usr/local/lib/libiconv.so.2 (0x816381000)
libpcre.so.1 => /usr/local/lib/libpcre.so.1 (0x81667c000)
libffi.so.6 => /usr/local/lib/libffi.so.6 (0x81691a000)
libgnutls.so.30 => /usr/local/lib/libgnutls.so.30 (0x816b21000)
libavahi-common.so.3 => /usr/local/lib/libavahi-common.so.3 (0x816ed4000)
libavahi-client.so.3 => /usr/local/lib/libavahi-client.so.3 (0x8170e0000)
libcrypt.so.5 => /lib/libcrypt.so.5 (0x8172ef000)
libelf.so.2 => /lib/libelf.so.2 (0x81750e000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x817725000)
libbz2.so.4 => /usr/lib/libbz2.so.4 (0x817934000)
libgraphite2.so.3 => /usr/local/lib/libgraphite2.so.3 (0x817b48000)
libswresample.so.3 => /usr/local/lib/libswresample.so.3 (0x817d71000)
libvpx.so.6 => /usr/local/lib/libvpx.so.6 (0x818000000)
libdav1d.so.1 => /usr/local/lib/libdav1d.so.1 (0x818411000)
libmp3lame.so.0 => /usr/local/lib/libmp3lame.so.0 (0x818732000)
libtheoraenc.so.1 => /usr/local/lib/libtheoraenc.so.1 (0x8189b3000)
libtheoradec.so.1 => /usr/local/lib/libtheoradec.so.1 (0x818be2000)
libvorbis.so.0 => /usr/local/lib/libvorbis.so.0 (0x818df3000)
libvorbisenc.so.2 => /usr/local/lib/libvorbisenc.so.2 (0x819024000)
libx264.so.155 => not found (0)
libx265.so.170 => /usr/local/lib/libx265.so.170 (0x819400000)
libxvidcore.so.4 => /usr/local/lib/libxvidcore.so.4 (0x819b4b000)
libva.so.2 => /usr/local/lib/libva.so.2 (0x819e70000)
libgmp.so.10 => /usr/local/lib/libgmp.so.10 (0x81a096000)
libva-drm.so.2 => /usr/local/lib/libva-drm.so.2 (0x81a316000)
libva-x11.so.2 => /usr/local/lib/libva-x11.so.2 (0x81a518000)
libvdpau.so.1 => /usr/local/lib/libvdpau.so.1 (0x81a71d000)
libpangoft2-1.0.so.0 => /usr/local/lib/libpangoft2-1.0.so.0 (0x81a920000)
libfribidi.so.0 => /usr/local/lib/libfribidi.so.0 (0x81ab36000)
libpixman-1.so.0 => /usr/local/lib/libpixman-1.so.0 (0x81ad4c000)
libEGL.so.1 => /usr/local/lib/libEGL.so.1 (0x81b016000)
libpng16.so.16 => /usr/local/lib/libpng16.so.16 (0x81b24e000)
libxcb-shm.so.0 => /usr/local/lib/libxcb-shm.so.0 (0x81b489000)
libxcb-render.so.0 => /usr/local/lib/libxcb-render.so.0 (0x81b68b000)
libxcb-dri3.so.0 => /usr/local/lib/libxcb-dri3.so.0 (0x81b898000)
libxcb-xfixes.so.0 => /usr/local/lib/libxcb-xfixes.so.0 (0x81ba9b000)
libxcb-present.so.0 => /usr/local/lib/libxcb-present.so.0 (0x81bca2000)
libxcb-sync.so.1 => /usr/local/lib/libxcb-sync.so.1 (0x81bea4000)
libxshmfence.so.1 => /usr/local/lib/libxshmfence.so.1 (0x81c0aa000)
libglapi.so.0 => /usr/local/lib/libglapi.so.0 (0x81c2ab000)
libxcb-glx.so.0 => /usr/local/lib/libxcb-glx.so.0 (0x81c505000)
libxcb-dri2.so.0 => /usr/local/lib/libxcb-dri2.so.0 (0x81c71e000)
libXxf86vm.so.1 => /usr/local/lib/libXxf86vm.so.1 (0x81c922000)
libogg.so.0 => /usr/local/lib/libogg.so.0 (0x81cb26000)
libXinerama.so.1 => /usr/local/lib/libXinerama.so.1 (0x81cd2c000)
libxkbcommon.so.0 => /usr/local/lib/libxkbcommon.so.0 (0x81cf2e000)
libwayland-cursor.so.0 => /usr/local/lib/libwayland-cursor.so.0 (0x81d16b000)
libwayland-egl.so.1 => /usr/local/lib/libwayland-egl.so.1 (0x81d372000)
libwayland-client.so.0 => /usr/local/lib/libwayland-client.so.0 (0x81d573000)
libepoxy.so.0 => /usr/local/lib/libepoxy.so.0 (0x81d782000)
libp11-kit.so.0 => /usr/local/lib/libp11-kit.so.0 (0x81da91000)
libtasn1.so.6 => /usr/local/lib/libtasn1.so.6 (0x81ddb2000)
libnettle.so.6 => /usr/local/lib/libnettle.so.6 (0x81dfc7000)
libhogweed.so.4 => /usr/local/lib/libhogweed.so.4 (0x81e1ff000)
libidn2.so.0 => /usr/local/lib/libidn2.so.0 (0x81e435000)
libunistring.so.2 => /usr/local/lib/libunistring.so.2 (0x81e653000)
libgbm.so.1 => /usr/local/lib/libgbm.so.1 (0x81ea07000)
libwayland-server.so.0 => /usr/local/lib/libwayland-server.so.0 (0x81ec15000)
libepoll-shim.so.0 => /usr/local/lib/libepoll-shim.so.0 (0x81ee28000)% ldd /usr/local/share/chromium/chrome | grep found
libx264.so.155 => not found (0)% cd /usr/local/lib
% ls -l libx264.so*
lrwxr-xr-x 1 root wheel 14 2019.03.19 02:11 libx264.so -> libx264.so.157
-rwxr-xr-x 1 root wheel 2090944 2019.03.19 02:11 libx264.so.157# pwd
/usr/local/lib
# ln -s libx264.so libx264.so.155
# ls -l libx264.so*
lrwxr-xr-x 1 root wheel 14 2019.03.19 02:11 libx264.so -> libx264.so.157
lrwxr-xr-x 1 root wheel 10 2019.03.21 15:26 libx264.so.155 -> libx264.so
-rwxr-xr-x 1 root wheel 2090944 2019.03.19 02:11 libx264.so.157% ldd /usr/local/share/chromium/chrome | grep found
%% chrome# cat /etc/libmap.conf
[/usr/local/share/chromium/chrome]
libx264.so.155 libx264.so# cat /etc/libmap.conf
libx264.so.155 libx264.so# portmaster --check-depends
(...)
Checking dependencies: evince
graphics/evince has a missing dependency: www/libxul19
(...)
>>> Missing package dependencies were detected.
>>> Found 1 issue(s) in total with your package database.
The following packages will be installed:
Downgrading perl: 5.14.2_3 -> 5.14.2_2
Downgrading glib: 2.34.3 -> 2.28.8_5
Downgrading gio-fam-backend: 2.34.3 -> 2.28.8_1
Downgrading libffi: 3.0.12 -> 3.0.11
Downgrading gobject-introspection: 1.34.2 -> 0.10.8_3
Downgrading atk: 2.6.0 -> 2.0.1
Downgrading gdk-pixbuf2: 2.26.5 -> 2.23.5_3
Downgrading pango: 1.30.1 -> 1.28.4_1
Downgrading gtk-update-icon-cache: 2.24.17 -> 2.24.6_1
Downgrading dbus: 1.6.8 -> 1.4.14_4
Downgrading gtk: 2.24.17 -> 2.24.6_2
Downgrading dbus-glib: 0.100.1 -> 0.94
Installing libxul: 1.9.2.28_1
The installation will require 66 MB more space
38 MB to be downloaded
>>> Try to fix the missing dependencies [y/N]: n
>>> Summary of actions performed:
www/libxul19 dependency failed to be fixed
>>> There are still missing dependencies.
>>> You are advised to try fixing them manually.
>>> Also make sure to check 'pkg updating' for known issues.# pkg info | grep libxul
libxul-10.0.12 Mozilla runtime package that can be used to bootstrap XUL+XPCOM apps
# pkg info -qoa | grep libxul
www/libxul# pkg shell
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .databases
seq name file
--- --------------- ----------------------------------------------------------
0 main /var/db/pkg/local.sqlite
sqlite> .tables
categories licenses pkg_directories scripts
deps mtree pkg_groups shlibs
directories options pkg_licenses users
files packages pkg_shlibs
groups pkg_categories pkg_users
sqlite> .header on
sqlite> .mode column
sqlite> pragma table_info(deps);
cid name type notnull dflt_value pk
---------- ---------- ---------- ---------- ---------- ----------
0 origin TEXT 1 1
1 name TEXT 1 0
2 version TEXT 1 0
3 package_id INTEGER 0 1
sqlite> .quit# sqlite3 -column /var/db/pkg/local.sqlite "select * from deps;" | grep libxul
www/libxul19 libxul 1.9.2.28_1 104sqlite3 -header -column /var/db/pkg/local.sqlite "select * from deps where name='libxul';"
origin name version package_id
------------ ---------- ---------- ----------
www/libxul19 libxul 1.9.2.28_1 104# sqlite3 /var/db/pkg/local.sqlite "update deps set origin='www/libxul' where name='libxul';"
# sqlite3 /var/db/pkg/local.sqlite "update deps set version='10.0.12' where name='libxul';"# pkg shell
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> update deps set origin='www/libxul' where name='libxul';
sqlite> update deps set version='10.0.12' where name='libxul';
sqlite> .header on
sqlite> .mode column
sqlite> select * from deps where name='libxul';
origin name version package_id
---------- ---------- ---------- ----------
www/libxul libxul 10.0.12 104
sqlite> .quit# portmaster --check-depends
(...)
Checking dependencies: zenity
Checking dependencies: zip
Checking dependencies: zsh
# -n oldname:newname, --change-name oldname:newname
Change the package name of a given dependency from oldname to newname.
将指定依赖项的包名从 `oldname` 修改为 `newname`。
(...)
-o oldorigin:neworigin, --change-origin oldorigin:neworigin
Change the port origin of a given dependency from oldorigin to neworigin.
This corresponds to the port directory that the package originated from.
Typically, this is only needed for upgrading a library or package that
has MOVED or when the default version of a major port dependency changes.
(DEPRECATED) Usually this will be explained in /usr/ports/UPDATING.
Also see pkg-updating(8) and EXAMPLES.
将指定依赖项的 Port 来源从 oldorigin 修改为 neworigin。
这对应于该包最初来源的 Port 目录。通常,仅在升级已被 MOVED 的库或包,或者主要 Port 依赖的默认版本发生变化时才需要使用此功能。(已弃用)通常相关说明会在 /usr/ports/UPDATING 中给出。
另请参见 pkg-updating(8) 和示例。# pkg search bsdadmin
bsdadminscripts-6.1.1_8 Collection of administration scripts
bsdadminscripts2-0.2.1 BSD Administration Scripts 2# pkg install bsdadminscripts
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (1 conflicting)
- bsdadminscripts-6.1.1_8 conflicts with bsdadminscripts2-0.2.1 on /usr/local/sbin/distviper
Checking integrity... done (0 conflicting)
The following 2 package(s) will be affected (of 0 checked):
Installed packages to be REMOVED:
bsdadminscripts2-0.2.1
New packages to be INSTALLED:
bsdadminscripts: 6.1.1_8
Number of packages to be removed: 1
Number of packages to be installed: 1
Proceed with this action? [y/N]: n# cat /usr/ports/ports-mgmt/bsdadminscripts2/pkg-descr
This is a collection of scripts around the use of ports and packages.
It allows you to:
- check library dependencies without producing false positives (pkg_libchk)
- lets you manage the autoremove flag for leaf packages (pkg_trim)
- remove obsolete or damaged distfiles (distviper)
- manage build flags (buildflags.conf)
- auto-create pkg-plist files taking port options into account (makeplist)
WWW: https://github.com/lonkamikaze/bsda2% pkg info -l bsdadminscripts2 | grep bin
/usr/local/sbin/distviper
/usr/local/sbin/makeplist
/usr/local/sbin/pkg_libchk
/usr/local/sbin/pkg_trim# pkg_libchk
Jobs done: 35 of 1057
bhyve-firmware-1.0_1
bash-5.0.3
beadm-1.2.9_1pkg_libchk chromium% pkg provides lib/libx264.so
Name : libx264-0.157.2945
Desc : H.264/MPEG-4 AVC Video Encoding (Library)
Repo : FreeBSD
Filename: /usr/local/lib/libx264.so.155
/usr/local/lib/libx264.so

$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
sda 8:0 0 931.5G 0 disk
|-sda1 8:1 0 500M 0 part /boot
`-sda2 8:2 0 931G 0 part
|-vg_local-lv_root (dm-0) 253:0 0 50G 0 lvm /
|-vg_local-lv_swap (dm-1) 253:1 0 17.7G 0 lvm [SWAP]
`-vg_local-lv_home (dm-2) 253:2 0 1.8T 0 lvm /home
sdc 8:32 0 232.9G 0 disk
`-sdc1 8:33 0 232.9G 0 part
`-md1 9:1 0 232.9G 0 raid10 /data
sdd 8:48 0 232.9G 0 disk
`-sdd1 8:49 0 232.9G 0 part
`-md1 9:1 0 232.9G 0 raid10 /data# camcontrol devlist
<Samsung SSD 860 EVO mSATA 1TB RVT41B6Q> at scbus1 target 0 lun 0 (ada0,pass0)
% geom disk list
Geom name: ada0
Providers:
1. Name: ada0
Mediasize: 1000204886016 (932G)
Sectorsize: 512
Mode: r1w1e2
descr: Samsung SSD 860 EVO mSATA 1TB
lunid: 5002538e402b4ddd
ident: S41PNB0K303632D
rotationrate: 0
fwsectors: 63
fwheads: 1
# gpart show
=> 40 1953525088 ada0 GPT (932G)
40 409600 1 efi (200M)
409640 1024 2 freebsd-boot (512K)
410664 984 - free - (492K)
411648 1953112064 3 freebsd-zfs (931G)
1953523712 1416 - free - (708K)% lsblk.sh
DEVICE MAJ:MIN SIZE TYPE LABEL MOUNT
ada0 0:5b 932G GPT - -
ada0p1 0:64 200M efi efiboot0 <UNMOUNTED>
ada0p2 0:65 512K freebsd-boot gptboot0 -
<FREE> -:- 492K - - -
ada0p3 0:66 931G freebsd-zfs zfs0 <ZFS>
<FREE> -:- 708K - - -# lsblk.sh
DEVICE MAJ:MIN SIZE TYPE LABEL MOUNT
da0 0:be 224G GPT - -
da0p1 0:15a 200M efi efiboot0 <UNMOUNTED>
da0p2 0:15b 512K freebsd-boot gptboot0 -
<FREE> -:- 492K - - -
da0p3 0:15c 2.0G freebsd-swap swap0 <UNMOUNTED>
da0p4 0:15d 221G freebsd-zfs zfs0 <ZFS>
<FREE> -:- 580K - - -
da1 0:bf 224G GPT - -
da1p1 0:16a 200M efi efiboot1 <UNMOUNTED>
da1p2 0:16b 512K freebsd-boot gptboot1 -
<FREE> -:- 492K - - -
da1p3 0:16c 2.0G freebsd-swap swap1 <UNMOUNTED>
da1p4 0:16d 221G freebsd-zfs zfs1 <ZFS>
<FREE> -:- 580K - - -
da2 0:c0 11T GPT - -
da2p1 0:16e 11T freebsd-zfs - <ZFS>
<FREE> -:- 1.0G - - -
da3 0:c1 11T GPT - -
da3p1 0:16f 11T freebsd-zfs - <ZFS>
<FREE> -:- 1.0G - - -# fetch -o /usr/local/bin/lsblk https://raw.githubusercontent.com/vermaden/scripts/master/lsblk.sh
# chmod +x /usr/local/bin/lsblk
# hash -r || rehash
# lsblk# lsblk.sh --help
usage:
BASIC USAGE INFORMATION
=======================
# lsblk.sh [DISK]
example(s):
LIST ALL BLOCK DEVICES IN SYSTEM
--------------------------------
# lsblk.sh
DEVICE MAJ:MIN SIZE TYPE LABEL MOUNT
ada0 0:5b 932G GPT - -
ada0p1 0:64 200M efi efiboot0 <UNMOUNTED>
ada0p2 0:65 512K freebsd-boot gptboot0 -
<FREE> -:- 492K - - -
ada0p3 0:66 931G freebsd-zfs zfs0 <ZFS>
LIST ONLY da1 BLOCK DEVICE
--------------------------
# lsblk.sh da1
DEVICE MAJ:MIN SIZE TYPE LABEL MOUNT
da1 0:80 2.0G MBR - -
da1s1 0:80 2.0G freebsd - -
da1s1a 0:81 1.0G freebsd-ufs root /
da1s1b 0:82 1.0G freebsd-swap swap SWAP
hint(s):
DISPLAY ALL DISKS IN SYSTEM
---------------------------
# sysctl kern.disks
kern.disks: ada0 da0 da1% git commit (...)
[master 12fd4aa] Rework entire flow. Split code into functions. Add many useful comments. In other words its 2.0 version.
1 file changed, 494 insertions(+), 505 deletions(-)
rewrite lsblk.sh (75%)% wc scripts/lsblk.sh.OLD
491 2201 19721 scripts/lsblk.sh.OLD
% wc scripts/lsblk.sh
494 1871 15472 scripts/lsblk.sh% glabel status | grep ada0p1
gpt/efiboot0 N/A ada0p1
msdosfs/EFISYS N/A ada0p1% mount -t fusefs
/dev/fuse on /mnt/ntfs (fusefs)
/dev/fuse on /mnt/exfat (fusefs)% mount -t nozfs
devfs on /dev (devfs, local, multilabel)
linprocfs on /compat/linux/proc (linprocfs, local)
tmpfs on /compat/linux/dev/shm (tmpfs, local)
/dev/label/ASD on /mnt/tmp (msdosfs, local)
/dev/fuse on /mnt/ntfs (fusefs)
/dev/md0s1f on /mnt/ufs.other (ufs, local)
/dev/gpt/OTHER on /mnt/fat.other (msdosfs, local)
/dev/md0s1a on /mnt/ufs (ufs, local)% lsblk.sh
DEVICE MAJ:MIN SIZE TYPE LABEL MOUNT
ada0 0:56 932G GPT - -
ada0p1 0:64 200M efi gpt/efiboot0 -
ada0p2 0:65 512K freebsd-boot gpt/gptboot0 -
<FREE> -:- 492K - - -
ada0p3 0:66 931G freebsd-zfs - <ZFS>
<FREE> -:- 708K - - -
md0 0:28f 1.0G MBR - -
md0s1 0:294 512M freebsd - -
md0s1a 0:29a 100M freebsd-ufs root /mnt/ufs
md0s1b 0:29b 32M freebsd-swap label/swap SWAP
md0s1e 0:29c 64M freebsd-ufs - -
md0s1f 0:29d 316M freebsd-ufs - /mnt/ufs.other
md0s2 0:296 256M ntfs - -
md0s3 0:297 256M fat32 msdosfs/ONE -
md1 0:2a4 1.0G msdosfs LARGE
md2 0:298 2.0G GPT - -
md2p1 0:29f 2.0G ms-basic-data gpt/OTHER /mnt/fat.other% mdconfig.sh -l
md0 vnode 1024M /home/vermaden/FILE
md2 vnode 2048M /home/vermaden/FILE.GPT
md1 vnode 1024M /home/vermaden/FILER% wc lsblk.sh.1.0
491 2201 19721 lsblk.sh.1.0
% wc lsblk.sh.2.0
493 1861 15415 lsblk.sh.2.0
% wc lsblk.sh
488 1820 15332 lsblk.sh# git commit (...)
[master ec9985a] Add geli(8) support. Avoid code duplication and move MOUNT/LABEL detection into function. More comments. Minor fixes.
1 file changed, 191 insertions(+), 196 deletions(-)# mount -t procfs proc /proc
# ps ax | grep ntfs-3g
45995 - Is 0:00.00 ntfs-3g /dev/md1s2 /mnt/ntfs
59607 - Is 0:00.00 ntfs-3g /dev/md3 /mnt/ntfs.another
83323 - Is 0:00.00 ntfs-3g /dev/md3 /mnt/ntfs.another
# pgrep ntfs-3g
59607
83323
45995
% pgrep ntfs-3g | while read I; do cat /proc/$I/cmdline; echo; done
ntfs-3g/dev/md3/mnt/ntfs.another
ntfs-3g/dev/md3/mnt/ntfs.another
ntfs-3g/dev/md1s2/mnt/ntfs if [ -e /proc/0/status ]
then
FUSE_MOUNTS=$(
while read PID
do
cat /proc/${PID}/cmdline
echo
done << ________EOF
$( pgrep ntfs-3g )
________EOF
)
FUSE_MOUNTS=$( echo "${FUSE_MOUNTS}" | sort -u )
FUSE_MOUNTS=$( echo "${FUSE_MOUNTS}" | sed 's|ntfs-3g||g' )
FUSE_CHECKS=$( echo "${FUSE_MOUNTS}" | grep /dev/${TARGET}/ )
if [ "${FUSE_CHECKS}" != "" ]
then
MOUNT=$( echo "${FUSE_CHECKS}" | sed "s|/dev/${TARGET}||g" )
fi
fi
fi% ps -p $( pgrep ntfs-3g | tr '\n' ',' | sed '$s/.$//' ) -o command | sed 1d
ntfs-3g /dev/md1s2 /mnt/ntfs
ntfs-3g /dev/md3 /mnt/ntfs.another
ntfs-3g /dev/md3 /mnt/ntfs.another # 尝试从进程中获取 fuse(8) 挂载点
if [ "${MOUNT_FOUND}" != "1" ]
then
FUSE_PIDS=$( pgrep mount.exfat ntfs-3g | tr '\n' ',' | sed '$s/.$//' )
FUSE_MOUNTS=$( ps -p "${FUSE_PIDS}" -o command | sed 1d | sort -u )
MOUNT=$( echo "${FUSE_MOUNTS}" | grep "/dev/${TARGET} " | awk '{print $3}' )
fi% ls -l /dev/md4
crw-rw---- 1 root operator 0x2af 2019.09.29 05:18 /dev/md4% gls -l /dev/md4
crw-rw---- 1 root 2, 175 2019-09-29 05:18 /dev/md4MAJ=$( stat -f "%Hr" /dev/${DEV} )
MIN=$( stat -f "%Lr" /dev/${DEV} )# gpart show md0
=> 63 2097089 md0 MBR (1.0G)
63 1048576 1 freebsd (512M)
1048639 524288 2 ntfs (256M)
1572927 524225 3 fat32 (256M)# gpart show -p md0
=> 63 2097089 md0 MBR (1.0G)
63 1048576 md0s1 freebsd (512M)
1048639 524288 md0s2 ntfs (256M)
1572927 524225 md0s3 fat32 (256M)# git commit (...)
(...)
1 file changed, 487 insertions(+), 501 deletions(-)
rewrite lsblk.sh (69%)# wc lsblk.sh
487 1791 13705 lsblk.sh
# wc lsblk.sh.OLD
544 1931 16170 lsblk.sh.OLD# pw groupmod operator -m yourself
#include <sys/capsicum.h>
#include <stdio.h>
int
main(void)
{
/* 进入 Capsicum 的能力模式。 */
cap_enter();
printf("能力模式下的 Hello world\n");
return (0);
}int dirfd;
dirfd = open("/home/jfree", O_RDONLY | O_DIRECTORY);
cap_enter();
/* 打开 "/home/jfree/foo"。 */
if (openat(dirfd, "foo", O_RDONLY) < 0)
printf("这不会发生\n");int dirfd;
dirfd = open("/home/jfree", O_RDONLY | O_DIRECTORY);
cap_enter();
/* 打开 "/home/beastie"。 */
if (openat(dirfd, "../beastie", O_RDONLY) < 0)
printf("这将会发生\n");pid_t pid;
int pipefd[2], result;
pipe(pipefd);
/*
* 创建一个子进程并将其隔离在能力沙箱中,
* 在其中执行危险代码。
*/
pid = fork();
if (pid == 0) {
close(pipefd[0]);
cap_enter();
result = dangerous_function();
write(pipefd[1], &result, sizeof(result));
exit(0);
}
close(pipefd[1]);
/* 从沙箱子进程获取结果。 */
result = read(pipefd[0], &result, sizeof(result));
printf("Result: %d\n", result);
/* 在父进程中继续正常执行。 */cap_channel_t *cap_casper, *cap_net;
struct addrinfo *res;
int s;
/* 获取访问 libcasper(3) 服务的能力。 */
cap_casper = cap_init();
/*
* 使用 cap_casper 能力与 "system.net" casper 服务
* 建立通信通道。
*/
cap_net = cap_service_open(cap_casper, "system.net");
/*
* 不再需要打开更多 casper 服务。
* 关闭 cap_casper 能力。
*/
cap_close(cap_casper);
/*
* 使用 cap_net(3) 库提供的 getaddrinfo() 变体。
*/
cap_getaddrinfo(cap_net, "freebsd.org", "80", NULL, &res);
s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
/*
* 使用 cap_net(3) 库提供的 connect() 变体。
*/
cap_connect(cap_net, s, res->ai_addr, res->ai_addrlen);CREATE_SERVICE(name, limit_func, command_func, flags);/*
* cap_net(3) casper 服务库使用的命令函数。
*/
static int
net_command(const char *cmd, const nvlist_t *limits, nvlist_t *nvlin,
nvlist_t *nvlout)
{
if (strcmp(cmd, "bind") == 0)
return (net_bind(limits, nvlin, nvlout));
else if (strcmp(cmd, "connect") == 0)
return (net_connect(limits, nvlin, nvlout));
else if (strcmp(cmd, "gethostbyname") == 0)
return (net_gethostbyname(limits, nvlin, nvlout));
else if (strcmp(cmd, "gethostbyaddr") == 0)
return (net_gethostbyaddr(limits, nvlin, nvlout));
else if (strcmp(cmd, "getnameinfo") == 0)
return (net_getnameinfo(limits, nvlin, nvlout));
else if (strcmp(cmd, "getaddrinfo") == 0)
return (net_getaddrinfo(limits, nvlin, nvlout));
return (EINVAL);
}
CREATE_SERVICE("system.net", net_limit, net_command, 0);/*
* 向与 @chan 绑定的 casper 服务发送 "bind" 命令。
*/
static int
cap_bind(cap_channel_t *chan, int sockfd, const struct sockaddr *addr,
socklen_t addrlen)
{
nvlist_t *nvl = nvlist_create(0);
int error;
nvlist_add_string(nvl, "cmd", "bind");
nvlist_add_descriptor(nvl, "sockfd", sockfd);
nvlist_add_binary(nvl, "addr", addr, addrlen);
nvl = cap_xfer_nvlist(chan, nvl);
if (nvl == NULL)
return (-1);
error = nvlist_get_number(nvl, "error");
if (error != 0) {
nvlist_destroy(nvl);
errno = error;
return (-1);
}
error = dup2(sockfd, nvlist_get_descriptor(nvl, "sockfd"));
nvlist_destroy(nvl);
return (error == -1 ? -1 : 0);
}if (strcmp(cmd, "bind") == 0)
return (net_bind(limits, nvlin, nvlout));/*
* net_bind() 函数的简化版。
* 负责从 @nvlin 提取参数,调用 bind(2),
* 并将返回值加入 @nvlout。
*/
static int
net_bind(const nvlist_t *limits __unused, nvlist_t *nvlin, nvlist_t *nvlout)
{
int sockfd;
const void *addr;
size_t len;
addr = nvlist_get_binary(nvlin, "addr", &len);
sockfd = nvlist_take_descriptor(nvlin, "sockfd");
if (bind(sockfd, saddr, len) < 0) {
int serrno = errno;
close(sockfd);
return (serrno);
}
nvlist_move_descriptor(nvlout, "sockfd", sockfd);
return (0);
}nvl = cap_xfer_nvlist(chan, nvl);
if (nvl == NULL)
err(1, "Failed transfer bind() nvlist");/*
* 使用 cap_net(3) 的限制机制,仅允许解析 freebsd.org
* 在 80 端口上的地址。
*
* 假设 cap_net(3) 服务已经被打开并在 @cap_net 上监听。
*/
cap_net_limit_t *limit;
int familylimit;
/* 仅允许名称解析 (cap_getaddrinfo(3))。 */
limit = cap_net_limit_init(cap_net, CAPNET_NAME2ADDR);
/* 将名称解析限制为 "freebsd.org" 的 80 端口。 */
cap_net_limit_name2addr(limit, "freebsd.org", "80");
/* 将名称解析限制为 IPv4 地址。 */
familylimit = AF_INET;
cap_net_limit_name2addr_family(limit, &familylimit, 1);
/* 将限制应用到 cap_net。 */
cap_net_limit(limit);/*
* cap_net(3) 中 net_limit() 函数的片段。
* 为清晰起见,部分代码被省略。
* 上下文见 "lib/libcasper/services/cap_net/cap_net.c"。
*/
while ((name = nvlist_next(newlimits, NULL, &cookie)) != NULL) {
/* ... */
if (strcmp(name, LIMIT_NV_BIND) == 0) {
hasbind = true;
if (!verify_bind_newlimts(oldlimits,
cnvlist_get_nvlist(cookie))) {
return (ENOTCAPABLE);
}
} else if (strcmp(name, LIMIT_NV_CONNECT) == 0) {
hasconnect = true;
if (!verify_connect_newlimits(oldlimits,
cnvlist_get_nvlist(cookie))) {
return (ENOTCAPABLE);
}
} else if (strcmp(name, LIMIT_NV_ADDR2NAME) == 0) {
hasaddr2name = true;
if (!verify_addr2name_newlimits(oldlimits,
cnvlist_get_nvlist(cookie))) {
return (ENOTCAPABLE);
}
} else if (strcmp(name, LIMIT_NV_NAME2ADDR) == 0) {
hasname2addr = true;
if (!verify_name2addr_newlimits(oldlimits,
cnvlist_get_nvlist(cookie))) {
return (ENOTCAPABLE);
}
}
}open("ktrace.out", O_RDONLY | O_CREAT | O_TRUNC);
ktrace("ktrace.out", KTROP_SET, KTRFAC_CAPFAIL, getpid());open("ktrace.out", O_RDONLY | O_CREAT | O_TRUNC);
ktrace("ktrace.out", KTROP_SET, KTRFAC_CAPFAIL, getpid());
cap_rights_init(&rights, CAP_READ);
caph_rights_limit(STDERR_FILENO, &rights);
write(STDERR_FILENO, &val, sizeof(val));
cap_rights_set(&rights, CAP_WRITE);
caph_rights_limit(STDERR_FILENO, &rights);
kinf.kf_structsize = sizeof(struct kinfo_file);
fcntl(STDIN_FILENO, F_KINFO, &kinf);
socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
addr.sin_family = AF_INET;
addr.sin_port = htons(5000);
addr.sin_addr.s_addr = INADDR_ANY;
bind(socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP),
(const struct sockaddr *)&addr, sizeof(addr));
sendto(fd, NULL, 0, 0, (const struct sockaddr *)&addr, sizeof(addr));
kill(getppid(), SIGCONT);
openat(AT_FDCWD, "/", O_RDONLY);
CPU_SET(0, &cpuset_mask);
cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, getppid(),
sizeof(cpuset_mask), &cpuset_mask);# ./cap_violate
# kdump
1915 cap_violate CAP operation requires CAP_WRITE, descriptor holds CAP_READ
1915 cap_violate CAP attempt to increase capabilities from CAP_READ to CAP_READ,CAP_WRITE
1915 cap_violate CAP system call not allowed: fcntl, cmd: F_KINFO
1915 cap_violate CAP socket: protocol not allowed: IPPROTO_ICMP
1915 cap_violate CAP system call not allowed: bind
1915 cap_violate CAP sendto: restricted address lookup: struct sockaddr { AF_INET, 0.0.0.0:5000 }
1915 cap_violate CAP kill: signal delivery not allowed: SIGCONT
1915 cap_violate CAP openat: restricted VFS lookup: AT_FDCWD
1915 cap_violate CAP cpuset_setaffinity: restricted cpuset operation# unzip foo.zip
# kdump
1926 unzip NAMI "foo.zip"
1926 unzip CAP openat: restricted VFS lookup: AT_FDCWD
1926 unzip CAP system call not allowed: open
1926 unzip NAMI "/etc/localtime"
1926 unzip NAMI "bar"
1926 unzip CAP fstatat: restricted VFS lookup: AT_FDCWD
1926 unzip CAP system call not allowed: mkdir
1926 unzip NAMI "bar"
1926 unzip NAMI "bar"
1926 unzip CAP fstatat: restricted VFS lookup: AT_FDCWD
1926 unzip NAMI "bar/bar.txt"
1926 unzip CAP fstatat: restricted VFS lookup: AT_FDCWD
1926 unzip NAMI "bar/bar.txt"
1926 unzip CAP openat: restricted VFS lookup: AT_FDCWD
1926 unzip NAMI "baz"
1926 unzip CAP fstatat: restricted VFS lookup: AT_FDCWD
1926 unzip CAP system call not allowed: mkdir
1926 unzip NAMI "baz"
1926 unzip NAMI "baz"
1926 unzip CAP fstatat: restricted VFS lookup: AT_FDCWD
1926 unzip NAMI "baz/baz.txt"
1926 unzip CAP fstatat: restricted VFS lookup: AT_FDCWD
1926 unzip NAMI "baz/baz.txt"
1926 unzip CAP openat: restricted VFS lookup: AT_FDCWD/*
* 将文件描述符限制为只读。
*/
cap_rights_t rights;
int fd;
char buf[1] = 'x';
fd = open("/home/jfree/foo", O_RDWR);
cap_rights_init(&rights, CAP_READ);
cap_rights_limit(fd, &rights);
if (read(fd, buf, sizeof(buf)) < 0)
printf("这不会发生,因为我们有 CAP_READ\n");
if (write(fd, buf, sizeof(buf)) < 0)
printf("这将会发生,因为我们缺少 CAP_WRITE\n");/*
* 试图扩展描述符的权限。
*/
cap_rights_t rights;
int fd;
fd = open("/home/jfree/foo", O_RDWR);
cap_rights_init(&rights, CAP_READ);
cap_rights_limit(fd, &rights);
cap_rights_set(&rights, CAP_WRITE);
if (cap_rights_limit(fd, &rights) < 0)
printf("应用权限失败;权限永远不能被提升\n");pkg query -e "%a = 0" "%n" $(pkg info -r python311)
或者
pkg query -e "%a = 0" "%n" $(pkg query '%ro' python311)pkg shell -cmd "SELECT p.name FROM deps AS d INNER JOIN packages AS p ON package_id = p.id WHERE d.origin = 'lang/python311' AND p.automatic = 0" < /dev/nullBbABbA






sysctlinfo_load="YES" ①
mac_priority_load="YES" ②
#hint.pcm.5.eq=1 ③kern.timecounter.alloweddeviation=0 ①
hw.usb.uaudio.buffer_ms=2 ②
hw.snd.latency=0 ③
dev.pcm.5.play.vchans=0 ④
dev.pcm.5.bitperfect=1 ⑤
hw.snd.default_unit=5 ⑥
#hw.snd.vpc_0db=80 ⑦
#dev.pcm.5.eq_preamp=-5 ⑧# ./wakeup_latency
0.007341
0.014410
0.037370
0.037336
0.037375
0.037345
0.037356
...
# sysctl kern.timecounter.alloweddeviation=0
kern.timecounter.alloweddeviation: 5 -> 0
# ./wakeup_latency
0.000061
0.000095
0.000077
0.000093
0.000096
0.000090
0.000062
...musicpd_enable="YES" ①# kldstatId Refs Address Size Name
1 43 0xffffffff80200000 1f3c6c0 kernel
2 1 0xffffffff8213d000 3368 sysctlbyname_improved.ko
3 1 0xffffffff82142000 77d8 cryptodev.ko
4 1 0xffffffff8214a000 5b18 sysctlinfo.ko
5 1 0xffffffff82150000 3c48 mac_priority.ko
6 1 0xffffffff82154000 5da658 zfs.ko
7 1 0xffffffff83020000 3390 acpi_wmi.ko
8 1 0xffffffff83024000 4250 ichsmb.ko
9 1 0xffffffff83029000 2178 smbus.ko
10 1 0xffffffff8302c000 e5b0 snd_uaudio.ko
11 1 0xffffffff8303b000 2a68 mac_ntpd.ko
12 1 0xffffffff8303e000 3560 fdescfs.ko
13 1 0xffffffff83042000 1aec0 ext2fs.ko# cat /dev/sndstatInstalled devices:
pcm0: <Realtek ALC233 (Analog 2.0+HP/2.0)> (play/rec)
pcm1: <Realtek ALC233 (Analog)> (play/rec)
pcm2: <Intel Braswell (HDMI/DP 8ch)> (play)
pcm3: <Intel Braswell (HDMI/DP 8ch)> (play)
pcm4: <Intel Braswell (HDMI/DP 8ch)> (play)
pcm5: <Cambridge Audio Cambridge Audio USB Audio 2.0> (play) default
No devices installed from userspace.# sysctl hw.snd.verbose=4
# cat /dev/sndstat...
pcm5: on uaudio0 (1p:0v/0r:0v) default
snddev flags=0x3e7<SIMPLEX,AUTOVCHAN,SOFTPCMVOL,BUSY,MPSAFE,REGISTERED,BITPERFECT,VPC>
[dsp5.play.0]: spd 44100, fmt 0x00201000, flags 0x2000012c, 0x00000001, pid 1059 (musicpd)
interrupts 45405, underruns 0, feed 45404, ready 8192
[b:5648/2824/2|bs:8192/2048/4]
channel flags=0x2000012c<RUNNING,TRIGGERED,SLEEPING,BUSY,BITPERFECT>
{userland} -> feeder_root(0x00201000) -> {hardware}
...# usbconfig -d ugen0.3 dump_device_descugen0.3: at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (2mA)
bLength = 0x0012
bDescriptorType = 0x0001
bcdUSB = 0x0200
bDeviceClass = 0x00ef <Miscellaneous device>
bDeviceSubClass = 0x0002
bDeviceProtocol = 0x0001
bMaxPacketSize0 = 0x0040
idVendor = 0x22e8
idProduct = 0xdac2
bcdDevice = 0x0326
iManufacturer = 0x0001 <Cambridge Audio >
iProduct = 0x0002 <Cambridge Audio USB Audio 2.0>
iSerialNumber = 0x0003 <0000>
bNumConfigurations = 0x0002# sysctl hw.sndhw.snd.maxautovchans: 16
hw.snd.default_unit: 5
hw.snd.default_auto: 0
hw.snd.verbose: 0
hw.snd.vpc_mixer_bypass: 0
0hw.snd.feeder_rate_quality: 1
hw.snd.feeder_rate_round: 25
hw.snd.feeder_rate_max: 2016000
hw.snd.feeder_rate_min: 1
hw.snd.feeder_rate_polyphase_max: 183040
hw.snd.feeder_rate_presets: 100:8:0.85 100:36:0.92 100:164:0.97
hw.snd.feeder_eq_exact_rate: 0
hw.snd.feeder_eq_presets: PEQ:16000,0.2500,62,0.2500:-9,9,1.0:44100,48000,88200,96000,176400,192000
hw.snd.basename_clone: 1
hw.snd.compat_linux_mmap: 0
hw.snd.syncdelay: -1
hw.snd.usefrags: 0
hw.snd.vpc_reset: 0
hw.snd.vpc_0db: 45
hw.snd.vpc_autoreset: 1
hw.snd.timeout: 5
hw.snd.latency_profile: 1
hw.snd.latency: 0
hw.snd.report_soft_matrix: 1
hw.snd.report_soft_formats: 1# sysctl dev.pcm.5dev.pcm.5.feedback_rate: 44098
dev.pcm.5.mode: 3
dev.pcm.5.bitperfect: 1
dev.pcm.5.buffersize: 0
dev.pcm.5.play.vchans: 0
dev.pcm.5.hwvol_mixer: vol
dev.pcm.5.hwvol_step: 5
dev.pcm.5.%iommu:
dev.pcm.5.%parent: uaudio0
dev.pcm.5.%pnpinfo:
dev.pcm.5.%location:
dev.pcm.5.%driver: pcm
dev.pcm.5.%desc: Cambridge Audio Cambridge Audio USB Audio 2.0# service musicpd stop
# rtprio 0 musicpd /usr/local/etc/musicpd.conf# ps -o rtprio -axl | grep [m]usicpdreal:0 137 1146 1 0 -52 0 415080 214420 select I<s - 0:06.55 musicpd /usr/local/etc/musicpd.conf# top -p `pgrep -d "," musicpd`last pid: 1162; load averages: 0.03, 0.07, 0.04 up 0+12:05:50 21:38:34
50 processes: 2 running, 46 sleeping, 2 waiting
CPU: 50.0% user, 0.0% nice, 50.0% system, 0.0% interrupt, 0.0% idle
Mem: 497M Active, 64M Inact, 998M Wired, 49M Buf, 2267M Free
ARC: 85M Total, 27M MFU, 55M MRU, 514K Header, 1935K Other
66M Compressed, 153M Uncompressed, 2.32:1 Ratio
Swap: 2048M Total, 2048M Free
PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND
1146 mpd 8 -52 r0 605M 227M select 0 0:12 0.00% musicpd# sysctl hw.usb.debug=1
# tail -f /var/log/messages...
Jan 21 21:55:44 freebsd kernel: usbd_pipe_enter: enter
Jan 21 21:55:44 freebsd kernel: usbd_transfer_done: err=USB_ERR_NORMAL_COMPLETION
Jan 21 21:55:44 freebsd kernel: usbd_callback_wrapper_sub: xfer=0xfffffe007c950278 endpoint=0xfffff800038ad968 sts=0 alen=2816, slen=2816, afrm=64, nfrm=64
Jan 21 21:55:44 freebsd kernel: usbd_pipe_start: start
Jan 21 21:55:44 freebsd kernel: usbd_transfer_submit: xfer=0xfffffe007c950278, endpoint=0xfffff800038ad968, nframes=64, dir=write
Jan 21 21:55:44 freebsd kernel: usb_dump_endpoint: endpoint=0xfffff800038ad968 edesc=0xfffff800056d6491 isoc_next=11268 toggle_next=0 bEndpointAddress=0x01
Jan 21 21:55:44 freebsd kernel: usb_dump_queue: endpoint=0xfffff800038ad968 xfer:
Jan 21 21:55:44 freebsd kernel: usbd_pipe_enter: enter
Jan 21 21:55:44 freebsd kernel: usbd_transfer_done: err=USB_ERR_NORMAL_COMPLETION
Jan 21 21:55:44 freebsd kernel: usbd_callback_wrapper_sub: xfer=0xfffffe007c950148 endpoint=0xfffff800038ad968 sts=0 alen=2824, slen=2824, afrm=64, nfrm=64
Jan 21 21:55:44 freebsd kernel: usbd_pipe_start: start
Jan 21 21:55:44 freebsd kernel: usbd_transfer_submit: xfer=0xfffffe007c950148, endpoint=0xfffff800038ad968, nframes=64, dir=write
Jan 21 21:55:44 freebsd kernel: usb_dump_endpoint: endpoint=0xfffff800038ad968 edesc=0xfffff800056d6491 isoc_next=11332 toggle_next=0 bEndpointAddress=0x01
Jan 21 21:55:44 freebsd kernel: usb_dump_queue: endpoint=0xfffff800038ad968 xfer:
...# sysctl hw.usb.uaudio.debug=1
# tail -f /var/log/messages...
Jan 21 21:53:43 freebsd kernel: uaudio_chan_play_sync_callback: Value = 0x00058330
Jan 21 21:53:43 freebsd kernel: uaudio_chan_play_sync_callback: Comparing 44099 Hz :: 44100 Hz
Jan 21 21:53:44 freebsd kernel: uaudio_chan_play_sync_callback: Value = 0x00058330
Jan 21 21:53:44 freebsd kernel: uaudio_chan_play_sync_callback: Comparing 44099 Hz :: 44100 Hz
Jan 21 21:53:45 freebsd kernel: uaudio_chan_play_sync_callback: Value = 0x00058330
Jan 21 21:53:45 freebsd kernel: uaudio_chan_play_sync_callback: Comparing 44099 Hz :: 44100 Hz
Jan 21 21:53:46 freebsd kernel: uaudio_chan_play_sync_callback: Value = 0x00058330
Jan 21 21:53:46 freebsd kernel: uaudio_chan_play_sync_callback: Comparing 44099 Hz :: 44100 Hz
Jan 21 21:53:47 freebsd kernel: uaudio_chan_play_sync_callback: Value = 0x00058330
Jan 21 21:53:47 freebsd kernel: uaudio_chan_play_sync_callback: Comparing 44099 Hz :: 44100 Hz
Jan 21 21:53:48 freebsd kernel: uaudio_chan_play_sync_callback: Value = 0x00058330
Jan 21 21:53:48 freebsd kernel: uaudio_chan_play_sync_callback: Comparing 44099 Hz :: 44100 Hz
...#/boot/loader.conf
...
hint.pcm.5.eq=1mixer -f /dev/mixer5 vol=0.75 pcm=0.75 bass=0.82 treble=0.76vol.volume: 0.75:0.75 -> 0.75:0.75
pcm.volume: 0.75:0.75 -> 0.75:0.75
bass.volume: 0.82:0.82 -> 0.82:0.82
treble.volume: 0.76:0.76 -> 0.76:0.76
pcm5:mixer: on uaudio0 (play)
vol = 0.75:0.75 pbk
bass = 0.82:0.82 pbk
treble = 0.76:0.76 pbk
pcm = 0.75:0.75 pbk# sysctl dev.pcm.5 | grep bitperfectdev.pcm.5.bitperfect: 0# sysctl hw.snd.vpc_0db=80hw.snd.vpc_0db: 45 -> 80# sysctl dev.pcm.5.eq_preamp=-5dev.pcm.5.eq_preamp: +0.0dB -> -5.0dBfilter {
plugin "ffmpeg"
name "equalizer"
graph "bass=f=62:t=h:w=120:g=10:n=1:r=f64, treble=f=16000:t=h:width=8000:g=2:n=1:r=f64"
}
audio_output {
type "oss"
name "OSS"
mixer_type "hardware"
replay_gain_handler "none"
filters "equalizer"
}filter {
plugin "ffmpeg"
name "equalizer"
graph "anequalizer=c0 f=62 w=120 g=10 t=0|c1 f=62 w=120 g=10 t=0|c0 f=16000 w=8000 g=2 t=0|c1 f=16000 w=8000 g=2 t=0"
}mixer_type "software"graph "anequalizer=c0 f=62 w=120 g=10 t=0|c1 f=62 w=120 g=10 t=0|c0 f=16000 w=8000 g=2 t=0|c1 f=16000 w=8000 g=2 t=0"peq 62Hz q0.51 10dB
peq 16kHz q2 3dB# newaliases -v
/etc/mail/aliases: 29 aliases, longest 10 bytes, 297 bytes total
# ln -s /usr/share/zoneinfo/Europe/Warsaw /etc/localtime
# date
Fri Aug 17 22:05:18 CEST 2018
# echo nameserver 1.1.1.1 > /etc/resolv.conf
# ping -c 3 freebsd.org
PING freebsd.org (96.47.72.84): 56 data bytes
64 bytes from 96.47.72.84: icmp_seq=0 ttl=51 time=117.918 ms
64 bytes from 96.47.72.84: icmp_seq=1 ttl=51 time=115.169 ms
64 bytes from 96.47.72.84: icmp_seq=2 ttl=51 time=115.392 ms
--- freebsd.org ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 115.169/116.160/117.918/1.247 ms# cat /etc/rc.conf
# 网络
hostname=blackbox.local
ifconfig_re0="inet 10.0.0.100/24 up"
defaultrouter="10.0.0.1"
# 守护进程 | 启用
zfs_enable=YES
sshd_enable=YES
ntpd_enable=YES
syncthing_enable=YES
syslogd_flags="-s -s"
# 守护进程 | 禁用
sendmail_enable=NONE
sendmail_submit_enable=NO
sendmail_outbound_enable=NO
sendmail_msp_queue_enable=NO
# 其他
dumpdev=NO
update_motd=NO
virecover_enable=NO
clear_tmp_enable=YES# grep url: /etc/pkg/FreeBSD.conf
url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly",
# sed -i '' s/quarterly/latest/g /etc/pkg/FreeBSD.conf
# grep url: /etc/pkg/FreeBSD.conf
url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",# env ASSUME_ALWAYS_YES=yes pkg update -f
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:11:amd64/latest, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done
[syncthing.local] Installing pkg-1.10.5_1...
[syncthing.local] Extracting pkg-1.10.5_1: 100%
Updating FreeBSD repository catalogue...
pkg: Repository FreeBSD load error: access repo file(/var/db/pkg/repo-FreeBSD.sqlite) failed: No such file or directory
[syncthing.local] Fetching meta.txz: 100% 944 B 0.9kB/s 00:01
[syncthing.local] Fetching packagesite.txz: 100% 6 MiB 352.7kB/s 00:19
Processing entries: 100%
FreeBSD repository update completed. 32388 packages processed.
All repositories are up to date.# pkg install -y syncthing
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
syncthing: 0.14.48
Number of packages to be installed: 1
The process will require 88 MiB more space.
15 MiB to be downloaded.
[1/1] Fetching syncthing-0.14.48.txz: 100% 15 MiB 525.3kB/s 00:29
Checking integrity... done (0 conflicting)
[1/1] Installing syncthing-0.14.48...
===> Creating groups.
Creating group 'syncthing' with gid '983'.
===> Creating users
Creating user 'syncthing' with uid '983'.
[1/1] Extracting syncthing-0.14.48: 100%
Message from syncthing-0.14.48:
WARNING: This version is not backwards compatible with 0.13.x, 0.12.x, 0.11.x
nor 0.10.x releases!
For more information, please read:
https://forum.syncthing.net/t/syncthing-v0-14-0/7806
https://github.com/syncthing/syncthing/releases/tag/v0.13.0
https://forum.syncthing.net/t/syncthing-v0-11-0-release-notes/2426
https://forum.syncthing.net/t/syncthing-syncthing-v0-12-0-beryllium-bedbug/6026# id syncthing
uid=983(syncthing) gid=983(syncthing) groups=983(syncthing)# pkg info -l syncthing
syncthing-0.14.48:
/usr/local/bin/stbench
/usr/local/bin/stcli
/usr/local/bin/stcompdirs
/usr/local/bin/stdisco
/usr/local/bin/stdiscosrv
/usr/local/bin/stevents
/usr/local/bin/stfileinfo
/usr/local/bin/stfinddevice
/usr/local/bin/stgenfiles
/usr/local/bin/stindex
/usr/local/bin/strelaypoolsrv
/usr/local/bin/strelaysrv
/usr/local/bin/stsigtool
/usr/local/bin/sttestutil
/usr/local/bin/stvanity
/usr/local/bin/stwatchfile
/usr/local/bin/syncthing
/usr/local/etc/rc.d/syncthing
/usr/local/etc/rc.d/syncthing-discosrv
/usr/local/etc/rc.d/syncthing-relaypoolsrv
/usr/local/etc/rc.d/syncthing-relaysrv
/usr/local/share/doc/syncthing/AUTHORS
/usr/local/share/doc/syncthing/LICENSE
/usr/local/share/doc/syncthing/README.md# /usr/local/etc/rc.d/syncthing rcvar
# syncthing
#
syncthing_enable="NO"
# (default: "")
# grep syncthing_enable /etc/rc.conf
syncthing_enable=YES# less -N /usr/local/etc/rc.d/syncthing
(...)
9 # Add the following lines to /etc/rc.conf.local or /etc/rc.conf
10 # to enable this service:
11 #
12 # syncthing_enable (bool): Set to NO by default.
13 # Set it to YES to enable syncthing.
14 # syncthing_home (path): Directory where syncthing configuration
15 # data is stored.
16 # Default: /usr/local/etc/syncthing
17 # syncthing_log_file (path): Syncthing log file
18 # Default: /var/log/syncthing.log
19 # syncthing_user (user): Set user to run syncthing.
20 # Default is "syncthing".
21 # syncthing_group (group): Set group to run syncthing.
22 # Default is "syncthing".
(...)# ls /var/log/syncthing.log
ls: /var/log/syncthing.log: No such file or directory
# :> /var/log/syncthing.log
# chown syncthing:syncthing /var/log/syncthing.log
# ls -l /var/log/syncthing.log
-rwxr-xr-x 1 syncthing syncthing 0 2018.08.19 01:06 /var/log/syncthing.log# cat > /etc/newsyslog.conf.d/syncthing.conf << __EOF
# logfilename [owner:group] mode count size when flags [/pid_file]
/var/log/syncthing.log syncthing:syncthing 640 7 100 * JC
__EOF
# cat /etc/newsyslog.conf.d/syncthing.conf
# logfilename [owner:group] mode count size when flags [/pid_file]
/var/log/syncthing.log syncthing:syncthing 640 7 100 * JC
# newsyslog -v | grep syncthing
Processing /etc/newsyslog.conf.d/syncthing
/var/log/syncthing.log : size (Kb): 0 [100] --> skipping# service syncthing start
Starting syncthing.
daemon: pidfile ``/var/run/syncthing.pid'': Permission denied
/usr/local/etc/rc.d/syncthing: WARNING: failed to start syncthing
# :> /var/run/syncthing.pid
# chown syncthing:syncthing /var/run/syncthing.pid
# ls -l /var/run/syncthing.pid
-rwxr-xr-x 1 syncthing syncthing 0 2018.08.19 01:08 /var/run/syncthing.pid# service syncthing start
Starting syncthing.# sockstat -l -4 | grep syncthing
syncthing syncthing 27499 9 tcp46 *:22000 *:*
syncthing syncthing 27499 10 udp4 *:18876 *:*
syncthing syncthing 27499 13 udp4 *:21027 *:*
syncthing syncthing 27499 20 tcp4 127.0.0.1:8384 *:*# cat /var/log/syncthing.log
[start] 01:08:40 INFO: Generating ECDSA key and certificate for syncthing...
[MPN4S] 01:08:40 INFO: syncthing v0.14.48 "Dysprosium Dragonfly" (go1.10.3 freebsd-amd64) root@111amd64-default-job-12 2018-08-08 09:19:19 UTC [noupgrade]
[MPN4S] 01:08:40 INFO: My ID: MPN4S65-UQWC5SP-3LR2XDB-T5JNYET-VQEQC3X-DSAUI27-BQQKZQE-BWQ3NAO
[MPN4S] 01:08:41 INFO: Single thread SHA256 performance is 131 MB/s using minio/sha256-simd (89 MB/s using crypto/sha256).
[MPN4S] 01:08:41 INFO: Default folder created and/or linked to new config
[MPN4S] 01:08:41 INFO: Default config saved. Edit /usr/local/etc/syncthing/config.xml to taste or use the GUI
[MPN4S] 01:08:42 INFO: Hashing performance is 112.85 MB/s
[MPN4S] 01:08:42 INFO: Updating database schema version from 0 to 2...
[MPN4S] 01:08:42 INFO: Updated symlink type for 0 index entries and added 0 invalid files to global list
[MPN4S] 01:08:42 INFO: Finished updating database schema version from 0 to 2
[MPN4S] 01:08:42 INFO: No stored folder metadata for "default": recalculating
[MPN4S] 01:08:42 WARNING: Creating directory for "Default Folder" (default): mkdir /Sync/: permission denied
[MPN4S] 01:08:42 WARNING: Creating folder marker: folder path missing
[MPN4S] 01:08:42 INFO: Ready to synchronize "Default Folder" (default) (readwrite)
[MPN4S] 01:08:42 INFO: Overall send rate is unlimited, receive rate is unlimited
[MPN4S] 01:08:42 INFO: Rate limits do not apply to LAN connections
[MPN4S] 01:08:42 INFO: Using discovery server https://discovery-v4.syncthing.net/v2/?nolookup&id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW
[MPN4S] 01:08:42 INFO: Using discovery server https://discovery-v6.syncthing.net/v2/?nolookup&id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW
[MPN4S] 01:08:42 INFO: Using discovery server https://discovery.syncthing.net/v2/?noannounce&id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW
[MPN4S] 01:08:42 INFO: TCP listener ([::]:22000) starting
[MPN4S] 01:08:42 INFO: Relay listener (dynamic+https://relays.syncthing.net/endpoint) starting
[MPN4S] 01:08:42 WARNING: Error on folder "Default Folder" (default): folder path missing
[MPN4S] 01:08:42 INFO: Failed initial scan of readwrite folder "Default Folder" (default)
[MPN4S] 01:08:42 INFO: Device MPN4S65-UQWC5SP-3LR2XDB-T5JNYET-VQEQC3X-DSAUI27-BQQKZQE-BWQ3NAO is "blackbox.local" at [dynamic]
[MPN4S] 01:08:42 INFO: Loading HTTPS certificate: open /usr/local/etc/syncthing/https-cert.pem: no such file or directory
[MPN4S] 01:08:42 INFO: Creating new HTTPS certificate
[MPN4S] 01:08:42 INFO: GUI and API listening on 127.0.0.1:8384
[MPN4S] 01:08:42 INFO: Access the GUI via the following URL: http://127.0.0.1:8384/
[MPN4S] 01:08:55 INFO: Joined relay relay://11.12.13.14:443
[MPN4S] 01:09:02 INFO: Detected 1 NAT service# service syncthing stop
Stopping syncthing.
Waiting for PIDS: 27498.# find /usr/local/etc/syncthing
/usr/local/etc/syncthing
/usr/local/etc/syncthing/https-cert.pem
/usr/local/etc/syncthing/https-key.pem
/usr/local/etc/syncthing/cert.pem
/usr/local/etc/syncthing/key.pem
/usr/local/etc/syncthing/config.xml
/usr/local/etc/syncthing/index-v0.14.0.db
/usr/local/etc/syncthing/index-v0.14.0.db/MANIFEST-000000
/usr/local/etc/syncthing/index-v0.14.0.db/LOCK
/usr/local/etc/syncthing/index-v0.14.0.db/000001.log
/usr/local/etc/syncthing/index-v0.14.0.db/LOG
/usr/local/etc/syncthing/index-v0.14.0.db/CURRENT# grep '/Sync' /usr/local/etc/syncthing/config.xml
<folder id="default" label="Default Folder" path="//Sync" type="readwrite" rescanIntervalS="3600" fsWatcherEnabled="true" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
# ls /Sync
ls: /Sync: No such file or directory# mkdir /syncthing
# chown syncthing:syncthing /syncthing
# chmod 750 /syncthing
# vi /usr/local/etc/syncthing/config.xml
# grep '/syncthing' /usr/local/etc/syncthing/config.xml
<folder id="default" label="Default Folder" path="/syncthing" type="readwrite" rescanIntervalS="3600" fsWatcherEnabled="true" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true"># grep -i relay /usr/local/etc/syncthing/config.xml
<relaysEnabled>true</relaysEnabled>
<relayReconnectIntervalM>10</relayReconnectIntervalM>
# vi /usr/local/etc/syncthing/config.xml
# grep -i relay /usr/local/etc/syncthing/config.xml
<relaysEnabled>false</relaysEnabled>
<relayReconnectIntervalM>10</relayReconnectIntervalM>
# grep globalAnnounce /usr/local/etc/syncthing/config.xml
<globalAnnounceServer>default</globalAnnounceServer>
<globalAnnounceEnabled>true</globalAnnounceEnabled>
# vi /usr/local/etc/syncthing/config.xml
# grep globalAnnounce /usr/local/etc/syncthing/config.xml
<globalAnnounceServer>default</globalAnnounceServer>
<globalAnnounceEnabled>false</globalAnnounceEnabled># service syncthing stop
Stopping syncthing.
# :> /var/log/syncthing.log
# service syncthing start
Starting syncthing.# cat /var/log/syncthing.log
[MPN4S] 01:13:38 INFO: syncthing v0.14.48 "Dysprosium Dragonfly" (go1.10.3 freebsd-amd64) root@111amd64-default-job-12 2018-08-08 09:19:19 UTC [noupgrade]
[MPN4S] 01:13:38 INFO: My ID: MPN4S65-UQWC5SP-3LR2XDB-T5JNYET-VQEQC3X-DSAUI27-BQQKZQE-BWQ3NAO
[MPN4S] 01:13:39 INFO: Single thread SHA256 performance is 131 MB/s using minio/sha256-simd (89 MB/s using crypto/sha256).
[MPN4S] 01:13:40 INFO: Hashing performance is 112.97 MB/s
[MPN4S] 01:13:40 INFO: Ready to synchronize "Default Folder" (default) (readwrite)
[MPN4S] 01:13:40 INFO: Overall send rate is unlimited, receive rate is unlimited
[MPN4S] 01:13:40 INFO: Rate limits do not apply to LAN connections
[MPN4S] 01:13:40 INFO: Device MPN4S65-UQWC5SP-3LR2XDB-T5JNYET-VQEQC3X-DSAUI27-BQQKZQE-BWQ3NAO is "blackbox.local" at [dynamic]
[MPN4S] 01:13:40 INFO: TCP listener ([::]:22000) starting
[MPN4S] 01:13:40 INFO: Completed initial scan of readwrite folder "Default Folder" (default)
[MPN4S] 01:13:40 INFO: GUI and API listening on 127.0.0.1:8384
[MPN4S] 01:13:40 INFO: Access the GUI via the following URL: http://127.0.0.1:8384/# grep -B 1 -A 3 127.0.0.1 /usr/local/etc/syncthing/config.xml
<gui enabled="true" tls="false" debugging="false">
<address>127.0.0.1:8384</address>
<apikey>2jU5aR4zTJLGdEuSLLmdRGgfCgJaUpUv</apikey>
<theme>default</theme>
</gui>
# vi /usr/local/etc/syncthing/config.xml
# grep -B 1 -A 3 10.0.0.100 /usr/local/etc/syncthing/config.xml
<gui enabled="true" tls="true" debugging="false">
<address>10.0.0.100:8384</address>
<apikey>2jU5aR4zTJLGdEuSLLmdRGgfCgJaUpUv</apikey>
<theme>default</theme>
</gui># service syncthing stop
Stopping syncthing.
# :> /var/log/syncthing.log
# service syncthing start
Starting syncthing.
# cat /var/log/syncthing.log
[MPN4S] 01:16:20 INFO: syncthing v0.14.48 "Dysprosium Dragonfly" (go1.10.3 freebsd-amd64) root@111amd64-default-job-12 2018-08-08 09:19:19 UTC [noupgrade]
[MPN4S] 01:16:20 INFO: My ID: MPN4S65-UQWC5SP-3LR2XDB-T5JNYET-VQEQC3X-DSAUI27-BQQKZQE-BWQ3NAO
[MPN4S] 01:16:21 INFO: Single thread SHA256 performance is 131 MB/s using minio/sha256-simd (89 MB/s using crypto/sha256).
[MPN4S] 01:16:22 INFO: Hashing performance is 113.07 MB/s
[MPN4S] 01:16:22 INFO: Ready to synchronize "Default Folder" (default) (readwrite)
[MPN4S] 01:16:22 INFO: Overall send rate is unlimited, receive rate is unlimited
[MPN4S] 01:16:22 INFO: Rate limits do not apply to LAN connections
[MPN4S] 01:16:22 INFO: TCP listener ([::]:22000) starting
[MPN4S] 01:16:22 INFO: Completed initial scan of readwrite folder "Default Folder" (default)
[MPN4S] 01:16:22 INFO: Device MPN4S65-UQWC5SP-3LR2XDB-T5JNYET-VQEQC3X-DSAUI27-BQQKZQE-BWQ3NAO is "blackbox.local" at [dynamic]
[MPN4S] 01:16:22 INFO: GUI and API listening on 10.0.0.100:8384
[MPN4S] 01:16:22 INFO: Access the GUI via the following URL: https://10.0.0.100:8384/
[MPN4S] 01:16:42 INFO: Detected 1 NAT service# find /syncthing -type d
/syncthing
/syncthing/SM-A320FL
/syncthing/SM-A320FL/Camera
/syncthing/SM-A320FL/Camera/.AutoPortrait
/syncthing/SM-A320FL/Screenshots
/syncthing/SM-A320FL/.thumbnails
/syncthing/SM-A320FL/.stfolder# sysctl -d security.bsd
security.bsd: BSD security policy
security.bsd.stack_guard_page: Specifies the number of guard pages for a stack that grows
security.bsd.unprivileged_get_quota: Unprivileged processes may retrieve quotas for other uids and gids
security.bsd.hardlink_check_gid: Unprivileged processes cannot create hard links to files owned by other groups
security.bsd.hardlink_check_uid: Unprivileged processes cannot create hard links to files owned by other users
security.bsd.unprivileged_idprio: Allow non-root users to set an idle priority
security.bsd.unprivileged_proc_debug: Unprivileged processes may use process debugging facilities
security.bsd.conservative_signals: Unprivileged processes prevented from sending certain signals to processes whose credentials have changed
security.bsd.see_jail_proc: Unprivileged processes may see subjects/objects with different jail ids
security.bsd.see_other_gids: Unprivileged processes may see subjects/objects with different real gid
security.bsd.see_other_uids: Unprivileged processes may see subjects/objects with different real uid
security.bsd.unprivileged_read_msgbuf: Unprivileged processes may read the kernel message buffer
security.bsd.unprivileged_mlock: Allow non-root users to call mlock(2)
security.bsd.suser_enabled: processes with uid 0 have privilege
security.bsd.map_at_zero: Permit processes to map an object at virtual address 0.+---------+---------+-------+
| 年份 | FreeBSD | Linux |
+---------|---------|-------|
| 1999 | 18 | 19 |
| 2000 | 27 | 5 |
| 2001 | 36 | 22 |
| 2002 | 31 | 15 |
| 2003 | 14 | 19 |
| 2004 | 15 | 51 |
| 2005 | 17 | 133 |
| 2006 | 27 | 90 |
| 2007 | 9 | 62 |
| 2008 | 15 | 71 |
| 2009 | 11 | 102 |
| 2010 | 8 | 123 |
| 2011 | 10 | 83 |
| 2012 | 10 | 115 |
| 2013 | 13 | 189 |
| 2014 | 18 | 130 |
| 2015 | 6 | 86 |
| 2016 | 6 | 217 |
| 2017 | 23 | 454 |
| 2018 | 29 | 177 |
| 2019 | 18 | 170 |
| 2020 | 31 | 126 |
| 2021 | 25 | 158 |
| 2022 | 1 | 73 |
|---------|---------|-------|
| 总计 | 430 | 2780 |
+---------+---------+-------+sshd_enable="YES"# service sshd enable# service sshd start# service sshd onestarthost # commandhost % commandrabbitX # commandhost # mkdir -p /jail/BASE
host # fetch -o /jail/BASE/11.2-RELEASE.base.txz http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.1-RELEASE/base.txz
host # for I in 1 2; do echo ${I}; mkdir -p /jail/rabbit${I}; tar --unlink -xpJf /jail/BASE/11.2-RELEASE.base.txz -C /jail/rabbit${I}; done
1
2
host #host # for I in 1 2
do
cat >> /etc/jail.conf << __EOF
rabbit${I} {
host.hostname = rabbit${I}.local;
ip4.addr += 192.168.43.10${I};
ip4.addr += 10.0.0.10${I};
interface = wlan0;
path = /jail/rabbit${I};
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.clean;
mount.devfs;
allow.raw_sockets;
}
__EOF
done
host #host # cat /etc/jail.conf
rabbit1 {
host.hostname = rabbit1.local;
ip4.addr += 192.168.43.101;
ip4.addr += 10.0.0.101;
interface = wlan0;
path = /jail/rabbit1;
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.clean;
mount.devfs;
allow.raw_sockets;
}
rabbit2 {
host.hostname = rabbit2.local;
ip4.addr += 192.168.43.102;
ip4.addr += 10.0.0.102;
interface = wlan0;
path = /jail/rabbit2;
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.clean;
mount.devfs;
allow.raw_sockets;
}host # for I in 1 2; do service jail onestart rabbit${I}; done
Starting jails: rabbit1.
Starting jails: rabbit2.# jls
JID IP Address Hostname Path
1 192.168.43.101 rabbit1.local /jail/rabbit1
2 192.168.43.102 rabbit2.local /jail/rabbit2host # for I in 1 2; do cat /jail/rabbit${I}/etc/resolv.conf; done
nameserver 1.1.1.1
nameserver 1.1.1.1host # for I in 1 2; do sed -i '' s/quarterly/latest/g /jail/rabbit${I}/etc/pkg/FreeBSD.conf; done
host # for I in 1 2; do grep latest /jail/rabbit${I}/etc/pkg/FreeBSD.conf; done
url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",
url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",host # for I in 1 2; do jexec rabbit${I} env ASSUME_ALWAYS_YES=yes pkg install -y rabbitmq; echo; done
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:11:amd64/latest, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done
[rabbit1.local] Installing pkg-1.10.5_5...
[rabbit1.local] Extracting pkg-1.10.5_5: 100%
Updating FreeBSD repository catalogue...
pkg: Repository FreeBSD load error: access repo file(/var/db/pkg/repo-FreeBSD.sqlite) failed: No such file or directory
[rabbit1.local] Fetching meta.txz: 100% 944 B 0.9kB/s 00:01
[rabbit1.local] Fetching packagesite.txz: 100% 6 MiB 745.4kB/s 00:09
Processing entries: 100%
FreeBSD repository update completed. 32114 packages processed.
All repositories are up to date.
Updating database digests format: 100%
The following 2 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
rabbitmq: 3.7.15
erlang-runtime19: 21.3.8.2
Number of packages to be installed: 2
The process will require 104 MiB more space.
41 MiB to be downloaded.
[rabbit1.local] [1/2] Fetching rabbitmq-3.7.15.txz: 100% 9 MiB 762.2kB/s 00:12
[rabbit1.local] [2/2] Fetching erlang-runtime19-21.3.8.2.txz: 100% 33 MiB 978.8kB/s 00:35
Checking integrity... done (0 conflicting)
[rabbit1.local] [1/2] Installing erlang-runtime19-21.3.8.2...
[rabbit1.local] [1/2] Extracting erlang-runtime19-21.3.8.2: 100%
[rabbit1.local] [2/2] Installing rabbitmq-3.7.15...
===> Creating groups.
Creating group 'rabbitmq' with gid '135'.
===> Creating users
Creating user 'rabbitmq' with uid '135'.
[rabbit1.local] [2/2] Extracting rabbitmq-3.7.15: 100%
Message from erlang-runtime19-21.3.8.2:
===========================================================================
To use this runtime port for development or testing, just prepend
its binary path ("/usr/local/lib/erlang19/bin") to your PATH variable.
===========================================================================
(...)
// 对于另一个 rabbit2 Jail,同样执行相同的操作。 //host # for I in 1 2; do jexec rabbit${I} which rabbitmqctl; done
/usr/local/sbin/rabbitmqctl
/usr/local/sbin/rabbitmqctlhost # for I in 1 2; do cat >> /jail/rabbit${I}/etc/hosts << __EOF
192.168.43.101 rabbit1
192.168.43.102 rabbit2
__EOF
donehost # cat /jail/rabbit?/etc/hosts | grep 192.168.43 | sort -n | uniq -c
2 192.168.43.101 rabbit1
2 192.168.43.102 rabbit2host # jexec rabbit1 /usr/local/etc/rc.d/rabbitmq rcvar
# rabbitmq
#
rabbitmq_enable="NO"
# (default: "")host # for I in 1 2; do jexec rabbit${I} sysrc rabbitmq_enable=YES; done
rabbitmq_enable: -> YES
rabbitmq_enable: -> YEShost # for I in 1 2; do jexec rabbit${I} service rabbitmq start; done
Starting rabbitmq.
Starting rabbitmq.rabbit1 # rabbitmq-plugins list
Configured: E = explicitly enabled; e = implicitly enabled
| Status: * = running on rabbit@rabbit1
|/
[ ] rabbitmq_amqp1_0 3.7.15
[ ] rabbitmq_auth_backend_cache 3.7.15
[ ] rabbitmq_auth_backend_http 3.7.15
[ ] rabbitmq_auth_backend_ldap 3.7.15
[ ] rabbitmq_auth_mechanism_ssl 3.7.15
[ ] rabbitmq_consistent_hash_exchange 3.7.15
[ ] rabbitmq_event_exchange 3.7.15
[ ] rabbitmq_federation 3.7.15
[ ] rabbitmq_federation_management 3.7.15
[ ] rabbitmq_jms_topic_exchange 3.7.15
[ ] rabbitmq_management 3.7.15
[ ] rabbitmq_management_agent 3.7.15
[ ] rabbitmq_mqtt 3.7.15
[ ] rabbitmq_peer_discovery_aws 3.7.15
[ ] rabbitmq_peer_discovery_common 3.7.15
[ ] rabbitmq_peer_discovery_consul 3.7.15
[ ] rabbitmq_peer_discovery_etcd 3.7.15
[ ] rabbitmq_peer_discovery_k8s 3.7.15
[ ] rabbitmq_random_exchange 3.7.15
[ ] rabbitmq_recent_history_exchange 3.7.15
[ ] rabbitmq_sharding 3.7.15
[ ] rabbitmq_shovel 3.7.15
[ ] rabbitmq_shovel_management 3.7.15
[ ] rabbitmq_stomp 3.7.15
[ ] rabbitmq_top 3.7.15
[ ] rabbitmq_tracing 3.7.15
[ ] rabbitmq_trust_store 3.7.15
[ ] rabbitmq_web_dispatch 3.7.15
[ ] rabbitmq_web_mqtt 3.7.15
[ ] rabbitmq_web_mqtt_examples 3.7.15
[ ] rabbitmq_web_stomp 3.7.15
[ ] rabbitmq_web_stomp_examples 3.7.15host # for I in 1 2; do jexec rabbit${I} rabbitmq-plugins enable rabbitmq_management; done
The following plugins have been configured:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
Applying plugin configuration to rabbit@rabbit1...
The following plugins have been enabled:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
started 3 plugins.
(...)
// 对于另一个 rabbit2 Jail,同样启用 Web 界面插件。 //rabbit1 # rabbitmq-plugins list
Configured: E = explicitly enabled; e = implicitly enabled
| Status: * = running on rabbit@rabbit1
|/
[ ] rabbitmq_amqp1_0 3.7.15
[ ] rabbitmq_auth_backend_cache 3.7.15
[ ] rabbitmq_auth_backend_http 3.7.15
[ ] rabbitmq_auth_backend_ldap 3.7.15
[ ] rabbitmq_auth_mechanism_ssl 3.7.15
[ ] rabbitmq_consistent_hash_exchange 3.7.15
[ ] rabbitmq_event_exchange 3.7.15
[ ] rabbitmq_federation 3.7.15
[ ] rabbitmq_federation_management 3.7.15
[ ] rabbitmq_jms_topic_exchange 3.7.15
[E*] rabbitmq_management 3.7.15
[e*] rabbitmq_management_agent 3.7.15
[ ] rabbitmq_mqtt 3.7.15
[ ] rabbitmq_peer_discovery_aws 3.7.15
[ ] rabbitmq_peer_discovery_common 3.7.15
[ ] rabbitmq_peer_discovery_consul 3.7.15
[ ] rabbitmq_peer_discovery_etcd 3.7.15
[ ] rabbitmq_peer_discovery_k8s 3.7.15
[ ] rabbitmq_random_exchange 3.7.15
[ ] rabbitmq_recent_history_exchange 3.7.15
[ ] rabbitmq_sharding 3.7.15
[ ] rabbitmq_shovel 3.7.15
[ ] rabbitmq_shovel_management 3.7.15
[ ] rabbitmq_stomp 3.7.15
[ ] rabbitmq_top 3.7.15
[ ] rabbitmq_tracing 3.7.15
[ ] rabbitmq_trust_store 3.7.15
[e*] rabbitmq_web_dispatch 3.7.15
[ ] rabbitmq_web_mqtt 3.7.15
[ ] rabbitmq_web_mqtt_examples 3.7.15
[ ] rabbitmq_web_stomp 3.7.15
[ ] rabbitmq_web_stomp_examples 3.7.15rabbot1 # cat /var/db/rabbitmq/.erlang.cookie; echo
NOEVQNXJDNLAJOSVWNIW
rabbot1 #host # for I in 1 2; do jexec rabbit${I} service rabbitmq stop; done
Stopping rabbitmq.
Waiting for PIDS: 88684.
Stopping rabbitmq.
Waiting for PIDS: 20976.host # for I in 1 2; do cat > /jail/rabbit${I}/var/db/rabbitmq/.erlang.cookie << __EOF
RABBITMQFREEBSDJAILS
__EOF
donehost # for I in 1 2; do jexec rabbit${I} service rabbitmq start; done
Starting rabbitmq.
Starting rabbitmq.host # for I in 1 2; do jexec rabbit${I} cat /var/db/rabbitmq/.erlang.cookie; done
RABBITMQFREEBSDJAILS
RABBITMQFREEBSDJAILShost # for I in 1 2; do jexec rabbit${I} rabbitmqctl add_user admin ADMINPASSWORD; done
Adding user "admin" ...
Adding user "admin" ...
host # for I in 1 2; do jexec rabbit${I} rabbitmqctl set_user_tags admin administrator; done
Setting tags for user "admin" to [administrator] ...
Setting tags for user "admin" to [administrator] ...
host # for I in 1 2; do jexec rabbit${I} rabbitmqctl set_permissions -p / admin ".*" ".*" ".*" ; done
Setting permissions for user "admin" in vhost "/" ...
Setting permissions for user "admin" in vhost "/" ...rabbit1 # rabbitmqctl cluster_status
Cluster status of node rabbit@rabbit1 ...
[{nodes,[{disc,[rabbit@rabbit1]}]},
{running_nodes,[rabbit@rabbit1]},
{cluster_name,},
{partitions,[]},
{alarms,[{rabbit@rabbit1,[]}]}]
rabbit2 # hostname
rabbit2.local
rabbit2 # rabbitmqctl join_cluster rabbit@rabbit1
Error: this command requires the 'rabbit' app to be stopped on the target node. Stop it with 'rabbitmqctl stop_app'.
Arguments given:
join_cluster rabbit@rabbit1
Usage
rabbitmqctl [--node ] [--longnames] [--quiet] join_cluster [--disc|--ram]rabbit2 # rabbitmqctl stop_app
Stopping rabbit application on node rabbit@rabbit2 ...
rabbit2 # rabbitmqctl join_cluster rabbit@rabbit1
Clustering node rabbit@rabbit2 with rabbit@rabbit1
rabbit2 # rabbitmqctl start_app
Starting node rabbit@rabbit2 ...
completed with 5 plugins.
rabbit2 # rabbitmqctl cluster_status
Cluster status of node rabbit@rabbit2 ...
[{nodes,[{disc,[rabbit@rabbit1,rabbit@rabbit2]}]},
{running_nodes,[rabbit@rabbit1,rabbit@rabbit2]},
{cluster_name,},
{partitions,[]},
{alarms,[{rabbit@rabbit1,[]},{rabbit@rabbit2,[]}]}]
rabbit1 # rabbitmqctl cluster_status
Cluster status of node rabbit@rabbit1 ...
[{nodes,[{disc,[rabbit@rabbit1,rabbit@rabbit2]}]},
{running_nodes,[rabbit@rabbit2,rabbit@rabbit1]},
{cluster_name,},
{partitions,[]},
{alarms,[{rabbit@rabbit2,[]},{rabbit@rabbit1,[]}]}]rabbit1 # rabbitmqctl set_cluster_name rabbit@cluster
Setting cluster name to rabbit@cluster ...
rabbit1 # rabbitmqctl cluster_status
Cluster status of node rabbit@rabbit1 ...
[{nodes,[{disc,[rabbit@rabbit1,rabbit@rabbit2]}]},
{running_nodes,[rabbit@rabbit2,rabbit@rabbit1]},
{cluster_name,},
{partitions,[]},
{alarms,[{rabbit@rabbit2,[]},{rabbit@rabbit1,[]}]}]rabbit1 # rabbitmqctl set_policy ha "^ha-\.*" '{"ha-mode":"all","ha-sync-mode":"automatic"}'
Setting policy "ha-mirror" for pattern "^ha-\." to "{"ha-mode":"all","ha-sync-mode":"automatic"}" with priority "0" for vhost "/" ...host # pkg install go
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
go: 1.12.5,1
Number of packages to be installed: 1
The process will require 262 MiB more space.
75 MiB to be downloaded.
Proceed with this action? [y/N]: y
(...)
host % go version
go version go1.12.5 freebsd/amd64host % cat send.go
package main
import (
"log"
"amqp"
)
func FAIL_ON_ERROR(err error, msg string) {
if err != nil {
log.Fatalf("%s: %s", msg, err)
}
}
func main() {
conn, err := amqp.Dial("amqp://admin:[email protected]:5672/")
FAIL_ON_ERROR(err, "ER: failed to connect to RabbitMQ")
defer conn.Close()
ch, err := conn.Channel()
FAIL_ON_ERROR(err, "ER: failed to open channel")
defer ch.Close()
q, err := ch.QueueDeclare(
"ha-default", // 队列名称
false, // 是否持久化
false, // 未使用时是否删除
false, // 是否排他
false, // 是否不等待
nil, // 参数
)
FAIL_ON_ERROR(err, "ER: failed to declare queue")
body := "Hello World!"
for i := 1; i <= 10; i++ {
err = ch.Publish(
"", // exchange 交换
q.Name, // routing key 路由键
false, // mandatory 强制
false, // immediate 立即
amqp.Publishing{
ContentType: "text/plain",
Body: []byte(body),
})
log.Printf("IN: sent message '%s' (%d)", body, i)
FAIL_ON_ERROR(err, "ER: failed to publish message")
}
}host % go run send.go
send.go:5:3: cannot find package "amqp" in any of:
/usr/local/go/src/amqp (from $GOROOT)
/home/vermaden/.gopkg/src/amqp (from $GOPATH)host % mkdir -p ~/.gopkg/src
host % cd !$
host % pwd
/home/vermaden/.gopkg/src
host % fetch https://github.com/streadway/amqp/archive/master.zip
host % unzip master.zip
Archive: /home/vermaden/.gopkg/src/master.zip
creating: amqp-master/
extracting: amqp-master/.gitignore
extracting: amqp-master/.travis.yml
(...)
extracting: amqp-master/uri.go
extracting: amqp-master/uri_test.go
extracting: amqp-master/write.go
host % rm master.zip
host % mv amqp-master amqp
host % cd amqp
host % pwd
/home/vermaden/.gopkg/src/amqp
host % exa
_examples confirms.go delivery_test.go LICENSE spec091.go
spec confirms_test.go doc.go pre-commit tls_test.go
allocator.go connection.go example_client_test.go read.go types.go
allocator_test.go connection_test.go examples_test.go read_test.go uri.go
auth.go consumers.go fuzz.go README.md uri_test.go
certs.sh consumers_test.go gen.sh reconnect_test.go write.go
channel.go CONTRIBUTING.md go.mod return.go
client_test.go delivery.go integration_test.go shared_test.go # GO SHELL SETUP
mkdir -p ~/.gopkg
export GOPATH=~/.gopkg
export PATH="${PATH}:~/.gopkg"host % go run send.go
2019/06/05 13:53:59 IN: sent message 'Hello World!' (1)
2019/06/05 13:53:59 IN: sent message 'Hello World!' (2)
2019/06/05 13:53:59 IN: sent message 'Hello World!' (3)
2019/06/05 13:53:59 IN: sent message 'Hello World!' (4)
2019/06/05 13:53:59 IN: sent message 'Hello World!' (5)
2019/06/05 13:53:59 IN: sent message 'Hello World!' (6)
2019/06/05 13:53:59 IN: sent message 'Hello World!' (7)
2019/06/05 13:53:59 IN: sent message 'Hello World!' (8)
2019/06/05 13:53:59 IN: sent message 'Hello World!' (9)
2019/06/05 13:53:59 IN: sent message 'Hello World!' (10)
%host % cat receive.go
package main
import (
"log"
"amqp"
)
func FAIL_ON_ERROR(err error, msg string) {
if err != nil {
log.Fatalf("%s: %s", msg, err)
}
}
func main() {
conn, err := amqp.Dial("amqp://admin:[email protected]:5672/")
FAIL_ON_ERROR(err, "ER: failed to connect to RabbitMQ")
defer conn.Close()
ch, err := conn.Channel()
FAIL_ON_ERROR(err, "ER: failed to open channel")
defer ch.Close()
q, err := ch.QueueDeclare(
"ha-default", // 队列名称
false, // 是否持久化
false, // 未使用时是否删除
false, // 是否排他
false, // 是否不等待
nil, // 参数
)
FAIL_ON_ERROR(err, "ER: failed to declare queue")
msgs, err := ch.Consume(
q.Name, // 队列
"", // 消费者
true, // 自动确认
false, // 是否排他
false, // no-local
false, // 是否不等待
nil, // 参数
)
FAIL_ON_ERROR(err, "ER: failed to register consumer")
forever := make(chan bool)
go func() {
for d := range msgs {
log.Printf("IN: received message: %s", d.Body)
}
}()
log.Printf("IN: waiting for messages")
log.Printf("IN: to exit press CTRL+C")
<-forever
}host % go run receive.go
2019/06/05 13:54:34 IN: waiting for messages
2019/06/05 13:54:34 IN: to exit press CTRL+C
2019/06/05 13:54:34 IN: received message: Hello World!
2019/06/05 13:54:34 IN: received message: Hello World!
2019/06/05 13:54:34 IN: received message: Hello World!
2019/06/05 13:54:34 IN: received message: Hello World!
2019/06/05 13:54:34 IN: received message: Hello World!
2019/06/05 13:54:34 IN: received message: Hello World!
2019/06/05 13:54:34 IN: received message: Hello World!
2019/06/05 13:54:34 IN: received message: Hello World!
2019/06/05 13:54:34 IN: received message: Hello World!
2019/06/05 13:54:34 IN: received message: Hello World!
^C
%host % go run receive.go
2019/06/05 13:52:34 IN: waiting for messages
2019/06/05 13:52:34 IN: to exit press CTRL+Chost % go run send.go
2019/06/05 13:53:59 IN: sent message 'Hello World!' (1)
2019/06/05 13:53:59 IN: sent message 'Hello World!' (2)
2019/06/05 13:53:59 IN: sent message 'Hello World!' (3)
(...)
2019/06/05 13:56:26 IN: sent message 'Hello World!' (99998)
2019/06/05 13:56:26 IN: sent message 'Hello World!' (99999)
2019/06/05 13:56:26 IN: sent message 'Hello World!' (100000)
%host # jls
JID IP Address Hostname Path
1 192.168.43.101 rabbit1.local /jail/rabbit1
2 192.168.43.102 rabbit2.local /jail/rabbit2
host # killall -9 -j 1
host # umount /jail/rabbit1/devhost # service jail onestart rabbit1
Starting jails: rabbit1.
host #











































F25 % cat /etc/rc.conf
# 静默 # ------------------------------------------------------------------
rc_startmsgs=NO
rc_info=NO
# 网络 # ------------------------------------------------------------------
hostname=f25.local
background_dhclient=YES
extra_netfs_types=NFS
defaultroute_delay=3
defaultroute_carrier_delay=3
wlans_iwm0=wlan0 # // network.sh
create_args_wlan0="country PL regdomain FCC4" # // network.sh
# ifconfig_wlan0="WPA SYNCDHCP powersave" # // network.sh
gateway_enable="YES"
harvest_mask=351
rtsol_flags="-i"
rtsold_flags="-a -i"
# 模块/通用/基本 # ------------------------------------------------------
kld_list="${kld_list} /boot/modules/i915kms.ko"
kld_list="${kld_list} fusefs coretemp sem cpuctl ichsmb cuse linux linux64"
kld_list="${kld_list} urndis"
# 模块/BHYVE/VIRTUALBOX # -------------------------------------------------
vboxnet_enable=NO
vm_enable=YES
vm_dir="zfs:zroot/vm"
vm_list="poudriere"
vm_delay="3"
pf_enable=YES
dnsmasq_enable=NO
# 电源 # --------------------------------------------------------------------
performance_cx_lowest=C1
economy_cx_lowest=Cmax
powerd_enable=YES
powerd_flags="-n adaptive -a hiadaptive -b adaptive -m 800 -M 1400"
powerdxx_enable=NO
powerdxx_flags="-n adaptive -a hiadaptive -b adaptive -m 800 -M 1400"
# 守护进程 | yes # ------------------------------------------------------------
zfs_enable=YES
xdm_enable=YES
xdm_tty=ttyv4
nfs_client_enable=YES
devd_flags="-n"
moused_enable=YES
syslogd_flags='-s -s'
sshd_enable=YES
local_unbound_enable=NO
webcamd_DEV=$( usbconfig | grep -i camera | awk -F ':' '{print $1}' )
webcamd_enable=YES
webcamd_0_flags="-d ${webcamd_DEV}"
ubuntu_enable=YES
rctl_enable=YES
dbus_enable=YES
cupsd_enable=YES
# 守护进程/temp | yes # -------------------------------------------------------
samba_server_enable=NO
nmbd_enable=NO
smbd_enable=NO
# 守护进程 | no # -------------------------------------------------------------
linux_enable=NO
openssh_enable=NO
openssh_flags='-4 -p 23'
sendmail_enable=NO
sendmail_submit_enable=YES
sendmail_outbound_enable=NO
sendmail_msp_queue_enable=NO
# 文件系统 # -----------------------------------------------------------------------
fsck_y_enable=YES
clear_tmp_enable=NO
clear_tmp_X=YES
growfs_enable=YES
# 其他 # --------------------------------------------------------------------
keyrate=fast
keymap=pl.kbd
virecover_enable=NO
update_motd=NO
devfs_system_ruleset=desktop
hostid_enable=YES
entropy_file=NO
savecore_enable=NO
dumpdev=AUTO
# NFSD # ---------------------------------------------------------------------
sshd_enable=YES
nfs_server_enable=YES
nfsv4_server_only=YES
nfs_server_flags="-t"
# JAIL # ---------------------------------------------------------------------
jail_enable=YES
jail_devfs_enable=YES
jail_list="minecraft"F25 % cat /etc/sysctl.conf
# HARVEST MASK FOR random(4)
kern.random.harvest.mask=33119
# 安全
security.bsd.see_jail_proc=0
security.bsd.unprivileged_proc_debug=0
# 安全性/禁用 Intel CPU MDS 缓解措施
hw.mds_disable=0
machdep.mitigations.mds.disable=0
# 安全/随机 PID
kern.randompid=1
# 令人烦恼的事项
vfs.usermount=1
kern.coredump=0
hw.syscons.bell=0
kern.vt.enable_bell=0
# ZFS 磁盘块大小对齐为 4k
vfs.zfs.min_auto_ashift=12
# ZFS 删除错误导致的 TRIM 问题 (def:64)
vfs.zfs.vdev.trim_max_active=1
# ZFS ARC 调优
vfs.zfs.arc.min=134217728
vfs.zfs.arc.max=536870912
# 禁用 ZFS 严格的 ZVOL 配额执行 (def:1)
vfs.zfs.zvol_enforce_quotas=0
# Jail/允许在 Jail 中升级
security.jail.chflags_allowed=1
# JAILS/允许 RAW SOCKETS
security.jail.allow_raw_sockets=1
# JAILS/允许 fdescfs(5)
security.jail.mount_fdescfs_allowed=1
security.jail.param.allow.mount.fdescfs=1
# 桌面/交互性
kern.sched.preempt_thresh=224
# 桌面量子用于时间共享线程,以 stathz 时钟滴答为单位 (def:12) NomadBSD
kern.sched.slice=3
# 桌面/Iridium/Chromium
kern.ipc.shm_allow_removed=1
# 采样率转换器质量 (0=low .. 4=high) (def:1) NomadBSD
hw.snd.feeder_rate_quality=3
# 性能/所有共享内存段将映射到不可分页内存
kern.ipc.shm_use_phys=1
# VIRTUALBOX aio(4) 设置
vfs.aio.max_buf_aio=8192
vfs.aio.max_aio_queue_per_proc=65536
vfs.aio.max_aio_per_proc=8192
vfs.aio.max_aio_queue=65536
# 允许普通用户使用 idprio(8)
security.bsd.unprivileged_idprio=1
# 网络/不向已关闭端口的报文发送 RST
net.inet.tcp.blackhole=2
# 网络/对拒绝的连接不发送“端口不可达”响应
net.inet.udp.blackhole=1
# 网络/限制 SYN/ACK 重传次数(默认:3)
net.inet.tcp.syncache.rexmtlimit=0
# 网络/如果 syncache 溢出则使用 TCP SYN Cookies(默认:1)
net.inet.tcp.syncookies=0
# 网络/分配随机的 ip_id 值(默认:0)
net.inet.ip.random_id=1
# 网络/启用发送 IP 重定向(默认:1)
net.inet.ip.redirect=0
# 网络/忽略 ICMP 重定向(默认:0)
net.inet.icmp.drop_redirect=1
# 网络/丢弃 SYN+FIN 设置的 TCP 数据包(默认:0)
net.inet.tcp.drop_synfin=1
# 网络/更快回收 FIN_WAIT_2 状态的关闭连接(默认:0)
net.inet.tcp.fast_finwait2_recycle=1
# 网络/某些 ICMP 不可达消息可能会在 SYN_SENT 状态中中断连接(默认:1)
net.inet.tcp.icmp_may_rst=0
# 网络/初始发送/接收套接字缓冲区大小
net.inet.tcp.sendspace=65536
net.inet.tcp.recvspace=65536
# BHYVE
net.link.tap.up_on_open=1
net.link.tap.user_open=1
# 参考: [https://lists.freebsd.org/archives/freebsd-stable/2023-November/001726.html](https://lists.freebsd.org/archives/freebsd-stable/2023-November/001726.html)
vfs.zfs.dmu_offset_next_sync=0
# 声卡音量
hw.snd.vpc_0db=35
# 默认音频输出设备
hw.snd.default_unit=0
# 提高软件时钟精度(默认:5) 2025/02/05
kern.timecounter.alloweddeviation=0
# 禁用 ZFS Deadman —— 有助于 ZFS 在会进入睡眠的 USB 驱动器上运行
vfs.zfs.deadman.enabled=0
# 最大监听套接字待处理连接队列大小(默认: 128)
kern.ipc.soacceptqueue=1024
# 最大监听套接字待处理连接队列大小(兼容模式)(默认: 128)
kern.ipc.somaxconn=1024
# 在慢启动期间 TCP 最大 CWND 增量限制为该段数(默认: 2)
net.inet.tcp.abc_l_var=16
# 启用 TCP Fast Open 服务器功能(默认: 0)
net.inet.tcp.fastopen.server_enable=1
# FIN-WAIT2 超时(默认: 60000)
net.inet.tcp.finwait2_timeout=8000
# 防止共享内存被换出到磁盘
kern.ipc.shm_use_phys=1
# 在挂起时不切换虚拟控制台
# 有时切换到不同 VT 会破坏硬件加速
# 参考: [https://github.com/freebsd/drm-kmod/issues/175](https://github.com/freebsd/drm-kmod/issues/175)
kern.vt.suspendswitch=0F25 % cat /boot/loader.conf
# CONSOLE 通用
autoboot_delay=2 # 使用 '-1' 表示不等待 | 使用 'NO' 表示无限等待
boot_mute=YES # 类似 LOADER 中的 '-m' 参数 —— 静音控制台并显示 FreeBSD 标志
loader_logo=none # 可选标志选项: fbsdbw beastiebw beastie none
loader_menu_frame="none"
screen.font="6x12"
# CONSOLE 分辨率
kern.vt.fb.default.mode="1920x1080"
efi_max_resolution="1920x1080"
vbe_max_resolution="1920x1080"
# WINE 修复
machdep.max_ldt_segment=2048
# 启动模块
aesni_load=YES
geom_eli_load=YES
cryptodev_load=YES
zfs_load=YES
# 启用帧缓冲压缩以节能
compat.linuxkpi.i915_enable_fbc=1
# 启动时跳过不必要的模式设置
compat.linuxkpi.i915_fastboot=1
# 启用节能显示 C 状态
compat.linuxkpi.i915_enable_dc=2
# 尽可能禁用显示电源井
# compat.linuxkpi.i915_disable_power_well=1
# 启用 Synaptics 支持
hw.psm.synaptics_support=1
# 禁用 /dev/diskid/* 和 /dev/gptid/* 磁盘条目
kern.geom.label.disk_ident.enable=0
kern.geom.label.gptid.enable=0
# 增加 ZFS 事务超时时间以节省电池
vfs.zfs.txg.timeout=10
# RACCT/RCTL 资源限制
kern.racct.enable=1
# ZFS 调优
vfs.zfs.prefetch_disable=1
# 电源管理:关闭没有驱动程序的设备
hw.pci.do_power_nodriver=3
# 电源管理 / 为每个核心单独优化 ISS 时钟
# machdep.hwpstate_pkg_ctrl=0
# 电源管理:每个使用的 AHCI 通道(ahcich 0-7)
hint.ahcich.0.pm_level=5
hint.ahcich.1.pm_level=5
hint.ahcich.2.pm_level=5
hint.ahcich.3.pm_level=5
hint.ahcich.4.pm_level=5
hint.ahcich.5.pm_level=5
hint.ahcich.6.pm_level=5
hint.ahcich.7.pm_level=5
# GELI 线程数
kern.geom.eli.threads=4
# 最大发送队列大小
net.link.ifqmaxlen=2048
# 禁用 USB 数据包过滤
hw.usb.no_pf=1
# 启动和关闭时不等待 USB 设备枚举
hw.usb.no_boot_wait=0
hw.usb.no_shutdown_wait=1
# 禁用 hwpstate_intel(4) 驱动
hint.hwpstate_intel.0.disabled=1F25 % cat /etc/devfs.rules
[desktop=10]
add path 'acd*' mode 0660 group operator
add path 'cd*' mode 0660 group operator
add path 'da*' mode 0660 group operator
add path 'pass*' mode 0660 group operator
add path 'xpt*' mode 0660 group operator
add path 'fd*' mode 0660 group operator
add path 'md*' mode 0660 group operator
add path 'uscanner*' mode 0660 group operator
add path 'lpt*' mode 0660 group cups
add path 'ulpt*' mode 0660 group cups
add path 'unlpt*' mode 0660 group cups
add path 'ugen*' mode 0660 group operator
add path 'usb/*' mode 0660 group operator
add path 'video*' mode 0660 group operator
add path 'cuse*' mode 0660 group operatorF25 % cat /etc/fstab
# SWAP
/dev/gpt/swap0 none swap sw 0 0
# /tmp @ RAM
tmpfs /tmp tmpfs rw,size=1g,mode=1777 0 0
# FreeBSD PSEUDO
procfs /proc procfs rw 0 0
# Ubuntu Linux PSEUDO
linprocfs /compat/ubuntu/proc linprocfs rw,failok,late 0 0
linsysfs /compat/ubuntu/sys linsysfs rw,failok,late 0 0
devfs /compat/ubuntu/dev devfs rw,failok,late 0 0
fdescfs /compat/ubuntu/dev/fd fdescfs rw,failok,late,linrdlnk 0 0
tmpfs /compat/ubuntu/dev/shm tmpfs rw,failok,late,size=1g,mode=1777 0 0
/home /compat/ubuntu/home nullfs rw,failok,late 0 0
/tmp /compat/ubuntu/tmp nullfs rw,failok,late 0 0F25 % grep '^[^#]' /etc/ttys
console none unknown off insecure
ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure
ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure
ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure
ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure
ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure
ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure
ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure
ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure
dcons "/usr/libexec/getty std.115200" vt100 off secure
xc0 "/usr/libexec/getty Pc" xterm onifconsole secure
rcons "/usr/libexec/getty std.115200" vt100 onifconsole secureF25 # cat /etc/wpa_supplicant.conf
# 通用
eapol_version=2
ap_scan=1
fast_reauth=1
# 开放网络
network={
key_mgmt=NONE
priority=0
}
# 隐藏 SSID 的 WIFI
network={
scan_ssid=1
ssid="hidden-network"
psk="12341234"
priority=0
}
# 命名开放网络
network={
ssid="Free_Internet"
key_mgmt=NONE
priority=0
}
# 普通 WPA/WPA2 加密网络
network={
ssid="SECURED"
psk="12345678"
}F25 % cat /usr/local/etc/automount.conf
USERUMOUNT=YES
USER=vermaden
FM='caja --no-desktop'
NICENAMES=YESF25 # cat /usr/local/etc/doas.conf
# 核心
permit nopass keepenv root as root
permit nopass keepenv vermaden as root
# network.sh 脚本
# pw groupmod network -m YOURUSERNAME
# cat /usr/local/etc/doas.conf
permit nopass :network as root cmd /etc/rc.d/netif args onerestart
permit nopass :network as root cmd /usr/sbin/service args squid onerestart
permit nopass :network as root cmd dhclient
permit nopass :network as root cmd ifconfig
permit nopass :network as root cmd killall args -9 dhclient
permit nopass :network as root cmd killall args -9 ppp
permit nopass :network as root cmd killall args -9 wpa_supplicant
permit nopass :network as root cmd ppp
permit nopass :network as root cmd route
permit nopass :network as root cmd tee args -a /etc/resolv.conf
permit nopass :network as root cmd tee args /etc/resolv.conf
permit nopass :network as root cmd umount
permit nopass :network as root cmd wpa_supplicantF25 % id vermaden | tr ' ' '\n' | tr ',' '\n'
uid=1000(vermaden)
gid=1000(vermaden)
groups=1000(vermaden)
0(wheel)
5(operator)
44(video)
47(realtime)
48(idletime)
69(network)
145(webcamd)
920(vboxusers)F25 % battery-time.sh
time: 3:30
bat0: 92%
bat1: 98%
F25 % battery-capacity.sh 0
Battery '0' model '01AV420' has efficiency: 96%
F25 % battery-capacity.sh 1
Battery '1' model '01AV425' has efficiency: 92%
F25 % battery-info.sh 0
Design capacity: 23940 mWh
Last full capacity: 23070 mWh
Technology: secondary (rechargeable)
Battery Swappable Capability: Non-swappable
Design voltage: 11400 mV
Capacity (warn): 1153 mWh
Capacity (low): 200 mWh
Cycle Count: 37
Measurement Accuracy: 95%
Max Average Interval: 1000 ms
Min Average Interval: 500 ms
Low/warn granularity: -1 mWh
Warn/full granularity: -1 mWh
Model number: 01AV420
Serial number: 1020
Type: LiP
OEM info: LGC
State: high
Remaining capacity: 100%
Remaining time: unknown
Present rate: 0 mW
Present voltage: 12713 mV
F25 % battery-info.sh 1
Design capacity: 23990 mWh
Last full capacity: 22220 mWh
Technology: secondary (rechargeable)
Design voltage: 10800 mV
Capacity (warn): 1111 mWh
Capacity (low): 200 mWh
Cycle Count: 10
Measurement Accuracy: 95%
Max Average Interval: 1000 ms
Min Average Interval: 500 ms
Low/warn granularity: -1 mWh
Warn/full granularity: -1 mWh
Model number: 01AV425
Serial number: 9001
Type: LION
OEM info: SANYO
State: high
Remaining capacity: 98%
Remaining time: unknown
Present rate: 0 mW
Present voltage: 12676 mVroot@node1:~ # cat /etc/rc.conf
hostname=node1
ifconfig_em0="inet 10.0.10.111/24 up"
defaultrouter=10.0.10.1
sshd_enable=YESroot@node1:~ # grep PermitRootLogin /etc/ssh/sshd_config
PermitRootLogin yes
root@node1:~ # service sshd restartvboxhost % ssh -l root localhost -p 2211root@node1:~ # echo 'nameserver 1.1.1.1' > /etc/resolv.conf
root@node1:~ # sed -i '' s/quarterly/latest/g /etc/pkg/FreeBSD.confroot@node1:~ # pkg install pacemaker2 corosync2 crmsh
root@node2:~ # pkg install pacemaker2 corosync2 crmsh
root@node3:~ # pkg install pacemaker2 corosync2 crmshMessage from pacemaker2-2.0.4:
--
For correct operation, maximum socket buffer size must be tuned
by performing the following command as root :
# sysctl kern.ipc.maxsockbuf=18874368
To preserve this setting across reboots, append the following
to /etc/sysctl.conf :
kern.ipc.maxsockbuf=18874368
======================================================================
Message from corosync2-2.4.5_1:
--
For correct operation, maximum socket buffer size must be tuned
by performing the following command as root :
# sysctl kern.ipc.maxsockbuf=18874368
To preserve this setting across reboots, append the following
to /etc/sysctl.conf :
kern.ipc.maxsockbuf=18874368root@node1:~ # echo 'kern.ipc.maxsockbuf=18874368' >> /etc/sysctl.conf
root@node1:~ # service sysctl restart
root@node2:~ # echo 'kern.ipc.maxsockbuf=18874368' >> /etc/sysctl.conf
root@node2:~ # service sysctl restart
root@node3:~ # echo 'kern.ipc.maxsockbuf=18874368' >> /etc/sysctl.conf
root@node3:~ # service sysctl restartroot@node1:~ # pkg info -l pacemaker2 | grep bin
/usr/local/sbin/attrd_updater
/usr/local/sbin/cibadmin
/usr/local/sbin/crm_attribute
/usr/local/sbin/crm_diff
/usr/local/sbin/crm_error
/usr/local/sbin/crm_failcount
/usr/local/sbin/crm_master
/usr/local/sbin/crm_mon
/usr/local/sbin/crm_node
/usr/local/sbin/crm_report
/usr/local/sbin/crm_resource
/usr/local/sbin/crm_rule
/usr/local/sbin/crm_shadow
/usr/local/sbin/crm_simulate
/usr/local/sbin/crm_standby
/usr/local/sbin/crm_ticket
/usr/local/sbin/crm_verify
/usr/local/sbin/crmadmin
/usr/local/sbin/fence_legacy
/usr/local/sbin/iso8601
/usr/local/sbin/pacemaker-remoted
/usr/local/sbin/pacemaker_remoted
/usr/local/sbin/pacemakerd
/usr/local/sbin/stonith_admin
root@node1:~ # pkg info -l corosync2 | grep bin
/usr/local/bin/corosync-blackbox
/usr/local/sbin/corosync
/usr/local/sbin/corosync-cfgtool
/usr/local/sbin/corosync-cmapctl
/usr/local/sbin/corosync-cpgtool
/usr/local/sbin/corosync-keygen
/usr/local/sbin/corosync-notifyd
/usr/local/sbin/corosync-quorumtool
root@node1:~ # pkg info -l crmsh | grep bin
/usr/local/bin/crmroot@node1:~ # tail -3 /etc/hosts
10.0.10.111 node1
10.0.10.112 node2
10.0.10.113 node3
root@node2:~ # tail -3 /etc/hosts
10.0.10.111 node1
10.0.10.112 node2
10.0.10.113 node3
root@node3:~ # tail -3 /etc/hosts
10.0.10.111 node1
10.0.10.112 node2
10.0.10.113 node3root@node1:~ # corosync-keygen
Corosync Cluster Engine Authentication key generator.
Gathering 1024 bits for key from /dev/random.
Press keys on your keyboard to generate entropy.
Writing corosync key to /usr/local/etc/corosync/authkey.
root@node1:~ # echo $?
0
root@node1:~ # ls -l /usr/local/etc/corosync/authkey
-r-------- 1 root wheel 128 Sep 2 20:37 /usr/local/etc/corosync/authkeyroot@node1:~ # pkg info -l corosync2 | grep example
/usr/local/etc/corosync/corosync.conf.example
/usr/local/etc/corosync/corosync.conf.example.udpuroot@node1:~ # cp /usr/local/etc/corosync/corosync.conf.example.udpu /usr/local/etc/corosync/corosync.conf
root@node1:~ # vi /usr/local/etc/corosync/corosync.conf
/* LOTS OF EDITS HERE */
root@node1:~ # cat /usr/local/etc/corosync/corosync.conf
totem {
version: 2
crypto_cipher: aes256
crypto_hash: sha256
transport: udpu
interface {
ringnumber: 0
bindnetaddr: 10.0.10.0
mcastport: 5405
ttl: 1
}
}
logging {
fileline: off
to_logfile: yes
to_syslog: no
logfile: /var/log/cluster/corosync.log
debug: off
timestamp: on
logger_subsys {
subsys: QUORUM
debug: off
}
}
nodelist {
node {
ring0_addr: 10.0.10.111
nodeid: 1
}
node {
ring0_addr: 10.0.10.112
nodeid: 2
}
node {
ring0_addr: 10.0.10.113
nodeid: 3
}
}
quorum {
provider: corosync_votequorum
expected_votes: 2
}root@node1:~ # pkg install -y rsync
root@node1:~ # rsync -av /usr/local/etc/corosync/ node2:/usr/local/etc/corosync/
The authenticity of host 'node2 (10.0.10.112)' can't be established.
ECDSA key fingerprint is SHA256:/ZDmln7GKi6n0kbad73TIrajPjGfQqJJX+ReSf3NMvc.
No matching host key fingerprint found in DNS.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node2' (ECDSA) to the list of known hosts.
Password for root@node2:
sending incremental file list
./
authkey
corosync.conf
service.d/
uidgid.d/
sent 1,100 bytes received 69 bytes 259.78 bytes/sec
total size is 4,398 speedup is 3.76
root@node1:~ # rsync -av /usr/local/etc/corosync/ node3:/usr/local/etc/corosync/
The authenticity of host 'node2 (10.0.10.112)' can't be established.
ECDSA key fingerprint is SHA256:/ZDmln7GKi6n0kbad73TIrajPjGfQqJJX+ReSf3NMvc.
No matching host key fingerprint found in DNS.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node3' (ECDSA) to the list of known hosts.
Password for root@node3:
sending incremental file list
./
authkey
corosync.conf
service.d/
uidgid.d/
sent 1,100 bytes received 69 bytes 259.78 bytes/sec
total size is 4,398 speedup is 3.76root@node1:~ # cksum /usr/local/etc/corosync/{authkey,corosync.conf}
2277171666 128 /usr/local/etc/corosync/authkey
1728717329 622 /usr/local/etc/corosync/corosync.conf
root@node2:~ # cksum /usr/local/etc/corosync/{authkey,corosync.conf}
2277171666 128 /usr/local/etc/corosync/authkey
1728717329 622 /usr/local/etc/corosync/corosync.conf
root@node3:~ # cksum /usr/local/etc/corosync/{authkey,corosync.conf}
2277171666 128 /usr/local/etc/corosync/authkey
1728717329 622 /usr/local/etc/corosync/corosync.confroot@node1:~ # sysrc corosync_enable=YES
corosync_enable: -> YES
root@node1:~ # sysrc pacemaker_enable=YES
pacemaker_enable: -> YES
root@node2:~ # sysrc corosync_enable=YES
corosync_enable: -> YES
root@node2:~ # sysrc pacemaker_enable=YES
pacemaker_enable: -> YES
root@node3:~ # sysrc corosync_enable=YES
corosync_enable: -> YES
root@node3:~ # sysrc pacemaker_enable=YES
pacemaker_enable: -> YESroot@node1:~ # service corosync start
Starting corosync.
Sep 02 20:55:35 notice [MAIN ] Corosync Cluster Engine ('2.4.5'): started and ready to provide service.
Sep 02 20:55:35 info [MAIN ] Corosync built-in features:
Sep 02 20:55:35 warning [MAIN ] interface section bindnetaddr is used together with nodelist. Nodelist one is going to be used.
Sep 02 20:55:35 warning [MAIN ] Please migrate config file to nodelist.
root@node1:~ # ps aux | grep corosync
root 1695 0.0 7.9 38340 38516 - S 20:55 0:00.40 /usr/local/sbin/corosync
root 1699 0.0 0.1 524 336 0 R+ 20:57 0:00.00 grep corosyncroot@node1:~ # crm status
Could not connect to the CIB: Socket is not connected
crm_mon: Error: cluster is not available on this node
ERROR: status: crm_mon (rc=102):root@node1:~ # service pacemaker start
Starting pacemaker.
root@node2:~ # service pacemaker start
Starting pacemaker.
root@node3:~ # service pacemaker start
Starting pacemaker.root@node1:~ # crm status
Cluster Summary:
* Stack: unknown
* Current DC: NONE
* Last updated: Wed Sep 2 20:58:51 2020
* Last change:
* 0 nodes configured
* 0 resource instances configured
Full List of Resources:
* No resourcesroot@node1:~ # crm status
Cluster Summary:
* Stack: corosync
* Current DC: node2 (version 2.0.4-2deceaa3ae) - partition with quorum
* Last updated: Wed Sep 2 21:02:49 2020
* Last change: Wed Sep 2 20:59:00 2020 by hacluster via crmd on node2
* 3 nodes configured
* 0 resource instances configured
Node List:
* Online: [ node1 node2 node3 ]
Full List of Resources:
* No resourcesroot@node1:~ # ps aux | grep pacemaker
root 1716 0.0 0.5 10844 2396 - Is 20:58 0:00.00 daemon: /usr/local/sbin/pacemakerd[1717] (daemon)
root 1717 0.0 5.2 49264 25284 - S 20:58 0:00.27 /usr/local/sbin/pacemakerd
hacluster 1718 0.0 6.1 48736 29708 - Ss 20:58 0:00.75 /usr/local/libexec/pacemaker/pacemaker-based
root 1719 0.0 4.5 40628 21984 - Ss 20:58 0:00.28 /usr/local/libexec/pacemaker/pacemaker-fenced
root 1720 0.0 2.8 25204 13688 - Ss 20:58 0:00.20 /usr/local/libexec/pacemaker/pacemaker-execd
hacluster 1721 0.0 3.9 38148 19100 - Ss 20:58 0:00.25 /usr/local/libexec/pacemaker/pacemaker-attrd
hacluster 1722 0.0 2.9 25460 13864 - Ss 20:58 0:00.17 /usr/local/libexec/pacemaker/pacemaker-schedulerd
hacluster 1723 0.0 5.4 49304 26300 - Ss 20:58 0:00.41 /usr/local/libexec/pacemaker/pacemaker-controld
root 1889 0.0 0.6 11348 2728 0 S+ 21:56 0:00.00 grep pacemakerroot@node1:~ # corosync-cmapctl | grep members
runtime.totem.pg.mrp.srp.members.1.config_version (u64) = 0
runtime.totem.pg.mrp.srp.members.1.ip (str) = r(0) ip(10.0.10.111)
runtime.totem.pg.mrp.srp.members.1.join_count (u32) = 1
runtime.totem.pg.mrp.srp.members.1.status (str) = joined
runtime.totem.pg.mrp.srp.members.2.config_version (u64) = 0
runtime.totem.pg.mrp.srp.members.2.ip (str) = r(0) ip(10.0.10.112)
runtime.totem.pg.mrp.srp.members.2.join_count (u32) = 1
runtime.totem.pg.mrp.srp.members.2.status (str) = joined
runtime.totem.pg.mrp.srp.members.3.config_version (u64) = 0
runtime.totem.pg.mrp.srp.members.3.ip (str) = r(0) ip(10.0.10.113)
runtime.totem.pg.mrp.srp.members.3.join_count (u32) = 1
runtime.totem.pg.mrp.srp.members.3.status (str) = joinedroot@node1:~ # corosync-quorumtool
Quorum information
------------------
Date: Wed Sep 2 21:00:38 2020
Quorum provider: corosync_votequorum
Nodes: 3
Node ID: 1
Ring ID: 1/12
Quorate: Yes
Votequorum information
----------------------
Expected votes: 3
Highest expected: 3
Total votes: 3
Quorum: 2
Flags: Quorate
Membership information
----------------------
Nodeid Votes Name
1 1 10.0.10.111 (local)
2 1 10.0.10.112
3 1 10.0.10.113root@node1:~ # cat /var/log/cluster/corosync.log
Sep 02 20:55:35 [1694] node1 corosync notice [MAIN ] Corosync Cluster Engine ('2.4.5'): started and ready to provide service.
Sep 02 20:55:35 [1694] node1 corosync info [MAIN ] Corosync built-in features:
Sep 02 20:55:35 [1694] node1 corosync warning [MAIN ] interface section bindnetaddr is used together with nodelist. Nodelist one is going to be used.
Sep 02 20:55:35 [1694] node1 corosync warning [MAIN ] Please migrate config file to nodelist.
Sep 02 20:55:35 [1694] node1 corosync notice [TOTEM ] Initializing transport (UDP/IP Unicast).
Sep 02 20:55:35 [1694] node1 corosync notice [TOTEM ] Initializing transmit/receive security (NSS) crypto: aes256 hash: sha256
Sep 02 20:55:35 [1694] node1 corosync notice [TOTEM ] The network interface [10.0.10.111] is now up.
Sep 02 20:55:35 [1694] node1 corosync notice [SERV ] Service engine loaded: corosync configuration map access [0]
Sep 02 20:55:35 [1694] node1 corosync info [QB ] server name: cmap
Sep 02 20:55:35 [1694] node1 corosync notice [SERV ] Service engine loaded: corosync configuration service [1]
Sep 02 20:55:35 [1694] node1 corosync info [QB ] server name: cfg
Sep 02 20:55:35 [1694] node1 corosync notice [SERV ] Service engine loaded: corosync cluster closed process group service v1.01 [2]
Sep 02 20:55:35 [1694] node1 corosync info [QB ] server name: cpg
Sep 02 20:55:35 [1694] node1 corosync notice [SERV ] Service engine loaded: corosync profile loading service [4]
Sep 02 20:55:35 [1694] node1 corosync notice [QUORUM] Using quorum provider corosync_votequorum
Sep 02 20:55:35 [1694] node1 corosync notice [SERV ] Service engine loaded: corosync vote quorum service v1.0 [5]
Sep 02 20:55:35 [1694] node1 corosync info [QB ] server name: votequorum
Sep 02 20:55:35 [1694] node1 corosync notice [SERV ] Service engine loaded: corosync cluster quorum service v0.1 [3]
Sep 02 20:55:35 [1694] node1 corosync info [QB ] server name: quorum
Sep 02 20:55:35 [1694] node1 corosync notice [TOTEM ] adding new UDPU member {10.0.10.111}
Sep 02 20:55:35 [1694] node1 corosync notice [TOTEM ] adding new UDPU member {10.0.10.112}
Sep 02 20:55:35 [1694] node1 corosync notice [TOTEM ] adding new UDPU member {10.0.10.113}
Sep 02 20:55:35 [1694] node1 corosync notice [TOTEM ] A new membership (10.0.10.111:4) was formed. Members joined: 1
Sep 02 20:55:35 [1694] node1 corosync warning [CPG ] downlist left_list: 0 received
Sep 02 20:55:35 [1694] node1 corosync notice [QUORUM] Members[1]: 1
Sep 02 20:55:35 [1694] node1 corosync notice [MAIN ] Completed service synchronization, ready to provide service.
Sep 02 20:58:14 [1694] node1 corosync notice [TOTEM ] A new membership (10.0.10.111:8) was formed. Members joined: 2
Sep 02 20:58:14 [1694] node1 corosync warning [CPG ] downlist left_list: 0 received
Sep 02 20:58:14 [1694] node1 corosync warning [CPG ] downlist left_list: 0 received
Sep 02 20:58:14 [1694] node1 corosync notice [QUORUM] This node is within the primary component and will provide service.
Sep 02 20:58:14 [1694] node1 corosync notice [QUORUM] Members[2]: 1 2
Sep 02 20:58:14 [1694] node1 corosync notice [MAIN ] Completed service synchronization, ready to provide service.
Sep 02 20:58:19 [1694] node1 corosync notice [TOTEM ] A new membership (10.0.10.111:12) was formed. Members joined: 3
Sep 02 20:58:19 [1694] node1 corosync warning [CPG ] downlist left_list: 0 received
Sep 02 20:58:19 [1694] node1 corosync warning [CPG ] downlist left_list: 0 received
Sep 02 20:58:19 [1694] node1 corosync warning [CPG ] downlist left_list: 0 received
Sep 02 20:58:19 [1694] node1 corosync notice [QUORUM] Members[3]: 1 2 3
Sep 02 20:58:19 [1694] node1 corosync notice [MAIN ] Completed service synchronization, ready to provide service.root@node1:~ # crm configure show
node 1: node1
node 2: node2
node 3: node3
property cib-bootstrap-options: \
have-watchdog=false \
dc-version=2.0.4-2deceaa3ae \
cluster-infrastructure=corosyncroot@node1:~ # crm configure property stonith-enabled=falseroot@node1:~ # crm configure show
node 1: node1
node 2: node2
node 3: node3
property cib-bootstrap-options: \
have-watchdog=false \
dc-version=2.0.4-2deceaa3ae \
cluster-infrastructure=corosync \
stonith-enabled=falseroot@node1:~ # crm configure primitive IP ocf:heartbeat:IPaddr2 params ip=10.0.10.200 cidr_netmask="24" op monitor interval="30s"root@node1:~ # crm configure show
node 1: node1
node 2: node2
node 3: node3
primitive IP IPaddr2 \
params ip=10.0.10.200 cidr_netmask=24 \
op monitor interval=30s
property cib-bootstrap-options: \
have-watchdog=false \
dc-version=2.0.4-2deceaa3ae \
cluster-infrastructure=corosync \
stonith-enabled=falseroot@node1:~ # crm status
Cluster Summary:
* Stack: corosync
* Current DC: node2 (version 2.0.4-2deceaa3ae) - partition with quorum
* Last updated: Wed Sep 2 22:03:35 2020
* Last change: Wed Sep 2 22:02:53 2020 by root via cibadmin on node1
* 3 nodes configured
* 1 resource instance configured
Node List:
* Online: [ node1 node2 node3 ]
Full List of Resources:
* IP (ocf::heartbeat:IPaddr2): Stopped
Failed Resource Actions:
* IP_monitor_0 on node3 'not installed' (5): call=5, status='complete', exitreason='Setup problem: couldn't find command: ip', last-rc-change='2020-09-02 22:02:53Z', queued=0ms, exec=132ms
* IP_monitor_0 on node2 'not installed' (5): call=5, status='complete', exitreason='Setup problem: couldn't find command: ip', last-rc-change='2020-09-02 22:02:54Z', queued=0ms, exec=120ms
* IP_monitor_0 on node1 'not installed' (5): call=5, status='complete', exitreason='Setup problem: couldn't find command: ip', last-rc-change='2020-09-02 22:02:53Z', queued=0ms, exec=110msroot@node1:~ # crm configure delete IProot@node1:~ # crm status
Cluster Summary:
* Stack: corosync
* Current DC: node2 (version 2.0.4-2deceaa3ae) - partition with quorum
* Last updated: Wed Sep 2 22:04:34 2020
* Last change: Wed Sep 2 22:04:31 2020 by root via cibadmin on node1
* 3 nodes configured
* 0 resource instances configured
Node List:
* Online: [ node1 node2 node3 ]
Full List of Resources:
* No resourcesroot@node1:~ # ls -l /usr/local/lib/ocf/resource.d/pacemaker
total 144
-r-xr-xr-x 1 root wheel 7484 Aug 29 01:22 ClusterMon
-r-xr-xr-x 1 root wheel 9432 Aug 29 01:22 Dummy
-r-xr-xr-x 1 root wheel 5256 Aug 29 01:22 HealthCPU
-r-xr-xr-x 1 root wheel 5342 Aug 29 01:22 HealthIOWait
-r-xr-xr-x 1 root wheel 9450 Aug 29 01:22 HealthSMART
-r-xr-xr-x 1 root wheel 6186 Aug 29 01:22 Stateful
-r-xr-xr-x 1 root wheel 11370 Aug 29 01:22 SysInfo
-r-xr-xr-x 1 root wheel 5856 Aug 29 01:22 SystemHealth
-r-xr-xr-x 1 root wheel 7382 Aug 29 01:22 attribute
-r-xr-xr-x 1 root wheel 7854 Aug 29 01:22 controld
-r-xr-xr-x 1 root wheel 16134 Aug 29 01:22 ifspeed
-r-xr-xr-x 1 root wheel 11040 Aug 29 01:22 o2cb
-r-xr-xr-x 1 root wheel 11696 Aug 29 01:22 ping
-r-xr-xr-x 1 root wheel 6356 Aug 29 01:22 pingd
-r-xr-xr-x 1 root wheel 3702 Aug 29 01:22 remoteroot@node1:~ # cp /usr/local/lib/ocf/resource.d/pacemaker/Dummy /usr/local/lib/ocf/resource.d/pacemaker/ifconfig
root@node1:~ # vi /usr/local/lib/ocf/resource.d/pacemaker/ifconfig
/* 输入量真大啊…… */root@node1:~ # setenv OCF_ROOT /usr/local/lib/ocf
root@node1:~ # ocf-tester -n resourcename /usr/local/lib/ocf/resource.d/pacemaker/ifconfig
Beginning tests for /usr/local/lib/ocf/resource.d/pacemaker/ifconfig...
* rc=3: Your agent has too restrictive permissions: should be 755
-:1: parser error : Start tag expected, '<' not found
usage: /usr/local/lib/ocf/resource.d/pacemaker/ifconfig {start|stop|monitor}
^
* rc=1: Your agent produces meta-data which does not conform to ra-api-1.dtd
* rc=3: Your agent does not support the meta-data action
* rc=3: Your agent does not support the validate-all action
* rc=0: Monitoring a stopped resource should return 7
* rc=0: The initial probe for a stopped resource should return 7 or 5 even if all binaries are missing
* Your agent does not support the notify action (optional)
* Your agent does not support the demote action (optional)
* Your agent does not support the promote action (optional)
* Your agent does not support master/slave (optional)
* rc=0: Monitoring a stopped resource should return 7
* rc=0: Monitoring a stopped resource should return 7
* rc=0: Monitoring a stopped resource should return 7
* Your agent does not support the reload action (optional)
Tests failed: /usr/local/lib/ocf/resource.d/pacemaker/ifconfig failed 9 testsroot@node1:~ # vi /usr/local/lib/ocf/resource.d/pacemaker/ifconfig
/* LOTS OF NERVOUS TYPING */
root@node1:~ # chmod 755 /usr/local/lib/ocf/resource.d/pacemaker/ifconfig
root@node1:~ # setenv OCF_ROOT /usr/local/lib/ocf
root@node1:~ # ocf-tester -n resourcename /usr/local/lib/ocf/resource.d/pacemaker/ifconfig
Beginning tests for /usr/local/lib/ocf/resource.d/pacemaker/ifconfig...
* Your agent does not support the notify action (optional)
* Your agent does not support the demote action (optional)
* Your agent does not support the promote action (optional)
* Your agent does not support master/slave (optional)
* Your agent does not support the reload action (optional)
/usr/local/lib/ocf/resource.d/pacemaker/ifconfig passed all testsroot@node1:~ # crm configure primitive IP ocf:pacemaker:ifconfig op monitor interval="30"root@node1:~ # crm status
Cluster Summary:
* Stack: corosync
* Current DC: node2 (version 2.0.4-2deceaa3ae) - partition with quorum
* Last updated: Wed Sep 2 22:44:52 2020
* Last change: Wed Sep 2 22:44:44 2020 by root via cibadmin on node1
* 3 nodes configured
* 1 resource instance configured
Node List:
* Online: [ node1 node2 node3 ]
Full List of Resources:
* IP (ocf::pacemaker:ifconfig): Started node1
Failed Resource Actions:
* IP_monitor_0 on node3 'not installed' (5): call=24, status='Not installed', exitreason='', last-rc-change='2020-09-02 22:42:52Z', queued=0ms, exec=5ms
* IP_monitor_0 on node2 'not installed' (5): call=24, status='Not installed', exitreason='', last-rc-change='2020-09-02 22:42:53Z', queued=0ms, exec=2msroot@node1:~ # rsync -av /usr/local/lib/ocf/resource.d/pacemaker/ node2:/usr/local/lib/ocf/resource.d/pacemaker/
Password for root@node2:
sending incremental file list
./
ifconfig
sent 3,798 bytes received 38 bytes 1,534.40 bytes/sec
total size is 128,003 speedup is 33.37
root@node1:~ # rsync -av /usr/local/lib/ocf/resource.d/pacemaker/ node3:/usr/local/lib/ocf/resource.d/pacemaker/
Password for root@node3:
sending incremental file list
./
ifconfig
sent 3,798 bytes received 38 bytes 1,534.40 bytes/sec
total size is 128,003 speedup is 33.37root@node1:~ # crm resource stop IP
root@node1:~ # crm configure delete IP
root@node1:~ # crm configure primitive IP ocf:pacemaker:ifconfig op monitor interval="30"root@node1:~ # crm status
Cluster Summary:
* Stack: corosync
* Current DC: node2 (version 2.0.4-2deceaa3ae) - partition with quorum
* Last updated: Wed Sep 2 22:45:46 2020
* Last change: Wed Sep 2 22:45:43 2020 by root via cibadmin on node1
* 3 nodes configured
* 1 resource instance configured
Node List:
* Online: [ node1 node2 node3 ]
Full List of Resources:
* IP (ocf::pacemaker:ifconfig): Started node1root@node1:~ # ifconfig em0
em0: flags=8843 metric 0 mtu 1500
options=81009b
ether 08:00:27:2a:78:60
inet 10.0.10.111 netmask 0xffffff00 broadcast 10.0.10.255
inet 10.0.10.200 netmask 0xffffff00 broadcast 10.0.10.255
media: Ethernet autoselect (1000baseT )
status: active
nd6 options=29
root@node2:~ # ifconfig em0
em0: flags=8843 metric 0 mtu 1500
options=81009b
ether 08:00:27:80:50:05
inet 10.0.10.112 netmask 0xffffff00 broadcast 10.0.10.255
media: Ethernet autoselect (1000baseT )
status: active
nd6 options=29
root@node3:~ # ifconfig em0
em0: flags=8843 metric 0 mtu 1500
options=81009b
ether 08:00:27:74:5e:b9
inet 10.0.10.113 netmask 0xffffff00 broadcast 10.0.10.255
media: Ethernet autoselect (1000baseT )
status: active
nd6 options=29root@node1:~ # crm resource move IP node3
INFO: Move constraint created for IP to node3
root@node1:~ # crm status
Cluster Summary:
* Stack: corosync
* Current DC: node2 (version 2.0.4-2deceaa3ae) - partition with quorum
* Last updated: Wed Sep 2 22:47:31 2020
* Last change: Wed Sep 2 22:47:28 2020 by root via crm_resource on node1
* 3 nodes configured
* 1 resource instance configured
Node List:
* Online: [ node1 node2 node3 ]
Full List of Resources:
* IP (ocf::pacemaker:ifconfig): Started node3root@node3:~ # ifconfig em0
em0: flags=8843 metric 0 mtu 1500
options=81009b
ether 08:00:27:74:5e:b9
inet 10.0.10.113 netmask 0xffffff00 broadcast 10.0.10.255
inet 10.0.10.200 netmask 0xffffff00 broadcast 10.0.10.255
media: Ethernet autoselect (1000baseT )
status: active
nd6 options=29
root@node1:~ # ifconfig em0
em0: flags=8843 metric 0 mtu 1500
options=81009b
ether 08:00:27:2a:78:60
inet 10.0.10.111 netmask 0xffffff00 broadcast 10.0.10.255
media: Ethernet autoselect (1000baseT )
status: active
nd6 options=29root@node2:~ # crm status
Cluster Summary:
* Stack: corosync
* Current DC: node2 (version 2.0.4-2deceaa3ae) - partition with quorum
* Last updated: Wed Sep 2 22:49:57 2020
* Last change: Wed Sep 2 22:47:29 2020 by root via crm_resource on node1
* 3 nodes configured
* 1 resource instance configured
Node List:
* Online: [ node1 node2 node3 ]
Full List of Resources:
* IP (ocf::pacemaker:ifconfig): Started node3
root@node3:~ # poweroff
root@node2:~ # crm status
Cluster Summary:
* Stack: corosync
* Current DC: node2 (version 2.0.4-2deceaa3ae) - partition with quorum
* Last updated: Wed Sep 2 22:50:16 2020
* Last change: Wed Sep 2 22:47:29 2020 by root via crm_resource on node1
* 3 nodes configured
* 1 resource instance configured
Node List:
* Online: [ node1 node2 ]
* OFFLINE: [ node3 ]
Full List of Resources:
* IP (ocf::pacemaker:ifconfig): Started node1
























vi /etc/sysctl.conf# Allow jail raw sockets
security.jail.allow_raw_sockets=1
# Allow upgrades in jail
security.jail.chflags_allowed=1sysctl security.jail.allow_raw_sockets=1sysctl security.jail.chflags_allowed=1vi /boot/loader.conf# RACCT/RCTL Resource limits
kern.racct.enable=1zfs create -o mountpoint=/jail zroot/jail
zfs create -o mountpoint=/jail/nextcloud zroot/jail/nextcloud
zfs create -o mountpoint=/jail/nextcloud/var/db/postgres/data -o recordsize=8k zroot/jail/nextcloud/pgsql
zfs get -r recordsize zroot/jailfetch -o - http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.0-RELEASE/base.txz | tar --unlink -xpJf - -C /jail/nextcloud
ls /jail/nextcloudvi /etc/jail.confnextcloud {
host.hostname = nextcloud.lab.bsd.pw;
ip4.addr = 172.16.28.2;
interface = em0;
path = /jail/nextcloud;
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.clean;
mount.devfs;
allow.raw_sockets;
sysvsem = new;
sysvshm = new;
sysvmsg = new;
}sysrc jail_enable=YES
sysrc jail_nextcloud_mount_enable=YES
vi /etc/hosts172.16.28.2 nextcloud.lab.bsd.pw nextcloudservice jail restart nextcloud
jexec 1 tcsh
vi /etc/hosts172.16.28.2 nextcloud.lab.bsd.pw nextcloudjexec 1 tcsh
newaliases -v
cp /usr/share/zoneinfo/America/Denver /etc/localtime
vi /etc/rc.conf# DAEMONS | yes
syslogd_flags="-s -s"
sshd_enable=YES
# php_fpm_enable=YES
# postgresql_enable=YES
# postgresql_class=postgres
# postgresql_data=/var/db/postgres/data
# memcached_enable=YES
# memcached_flags="-l 172.16.28.2"
# nginx_enable=YES
# DAEMONS | no
sendmail_enable=NONE
sendmail_submit_enable=NO
sendmail_outbound_enable=NO
sendmail_msp_queue_enable=NO
# OTHER
clear_tmp_enable=YES
clear_tmp_X=YES
extra_netfs_types=NFS
dumpdev=NO
update_motd=NO
keyrate=fastvi /etc/cron.d/sendmail-clean-clientmqueue# CLEAN SENDMAIL
0 * * * * root /bin/rm -r -f /var/spool/clientmqueue/*exit
service jail restart nextcloud
jls
jexec nextcloud tcsh
sockstat -l4
vi /etc/resolv.confnameserver 172.16.28.1ping -c 3 bsd.pw
exitpkg install -y poudriere
vi nextcloudpkglistwww/nextcloud
www/nginx
databases/memcached
security/sudo
databases/postgresql10-server
www/php72-opcache
devel/php72-intl
mail/cclient
mail/php72-imap
math/php72-gmp
ftp/php72-ftpvi /usr/local/etc/poudriere.d/amd64-12-0-make.confDEFAULT_VERSIONS += php=7.2
DEFAULT_VERSIONS += pgsql=10
OPTIONS_UNSET += MYSQL
OPTIONS_SET += PGSQLpoudriere bulk -j amd64-12-0 -p head -f nextcloudpkglistservice jail start nextcloud
jexec nextcloud tcsh
mkdir /mnt/amd64-12-0-head
exitvi /etc/fstab.nextcloud/usr/local/poudriere/data/packages/amd64-12-0-head /mnt/amd64-12-0-head nullfs rw 0 0mount -t nullfs /usr/local/poudriere/data/packages/amd64-12-0-head /jail/nextcloud/mnt/amd64-12-0-headservice jail restart nextcloud
jexec nextcloud tcshmkdir -p /usr/local/etc/pkg/reposvi /etc/pkg/FreeBSD.confFreeBSD: {
enabled: no
}vi /usr/local/etc/pkg/repos/amd64-12-0.confamd64-12-0: {
url: “file:///mnt/amd64-12-0-head”,
enabled: yes,
}pkg upgrade -fy
pkg install -y www/nextcloud www/nginx databases/memcached security/sudo databases/postgresql10-server www/php72-opcache devel/php72-intl mail/cclient mail/php72-imap math/php72-gmp ftp/php72-ftpvi /usr/local/etc/poudriere.confCHECK_CHANGED_OPTIONS=verbose
CHECK_CHANGED_DEPS=yespoudriere jail -j amd64-12-0 -upoudriere ports -p head -u
poudriere bulk -j amd64-12-0 -p head -f nextcloudpkglistjexec nextcloud tcsh
pkg update && pkg upgrade -yvi /etc/login.confpostgres:\
:lang=en_US.UTF-8:\
:setenv=LC_COLLATE=C:\
:tc=default:cap_mkdb /etc/login.conf
exit
service jail restart nextcloud
jexec nextcloud tcsh
chown postgres:postgres /var/db/postgres/data
vi /etc/rc.conf# DAEMONS | yes
syslogd_flags="-s -s"
sshd_enable=YES
# php_fpm_enable=YES
postgresql_enable=YES
postgresql_class=postgres
postgresql_data=/var/db/postgres/data
# memcached_enable=YES
# memcached_flags="-l 172.16.28.2"
# nginx_enable=YES
# DAEMONS | no
sendmail_enable=NONE
sendmail_submit_enable=NO
sendmail_outbound_enable=NO
sendmail_msp_queue_enable=NO
# OTHER
clear_tmp_enable=YES
clear_tmp_X=YES
extra_netfs_types=NFS
dumpdev=NO
update_motd=NO
keyrate=fast/usr/local/etc/rc.d/postgresql initdb
/usr/local/etc/rc.d/postgresql start
sockstat -l4
vi /var/db/postgres/data/pg_hba.conf# IPv4 local connections:
host all all 172.16.28.2/32 trust/usr/local/etc/rc.d/postgresql restart
psql -h nextcloud.lab.bsd.pw -U postgres
CREATE USER nextcloud WITH PASSWORD 'something_random_from_bitwarden_or_other_password_manager';
CREATE DATABASE nextcloud TEMPLATE template0 ENCODING 'UNICODE';
ALTER DATABASE nextcloud OWNER TO nextcloud;
\q
vi /var/db/postgres/data/vacumm.sh/usr/local/bin/reindexdb -a 1> /dev/null 2> /dev/null
/usr/local/bin/reindexdb -s 1> /dev/null 2> /dev/nullchmod +x /var/db/postgres/data/vacumm.sh
chown postgres:postgres /var/db/postgres/data/vacumm.sh
su - postgres -c 'crontab -e'0 0 * * * /var/db/postgres/data/vacuum.shsu - postgres -c 'crontab -l'mkdir -p /usr/local/etc/nginx/ssl
cd /usr/local/etc/nginx/ssl
openssl req -x509 -nodes -days 3650 -newkey rsa:4096 -keyout nginx.key -out nginx.crtsomething_random_from_bitwarden_or_other_password_managerchmod 400 nginx.key
ls -l
chown -R www:www /var/log/nginx
vi /usr/local/etc/nginx/nginx.confuser www;
worker_processes 4;
worker_rlimit_nofile 51200;
error_log /var/log/nginx/error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" ';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
upstream php-handler {
server unix:/var/run/php-fpm.sock;
}
server {
# ENFORCE HTTPS
listen 80;
server_name nextcloud.lab.bsd.pw;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name nextcloud.lab.bsd.pw;
ssl_certificate /usr/local/etc/nginx/ssl/nginx.crt;
ssl_certificate_key /usr/local/etc/nginx/ssl/nginx.key;
# HEADERS SECURITY RELATED
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
# HEADERS
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
# PATH TO THE ROOT OF YOUR INSTALLATION
root /usr/local/www/nextcloud/;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location = /.well-known/carddav {
return 301 $scheme://$host/remote.php/dav;
}
location = /.well-known/caldav {
return 301 $scheme://$host/remote.php/dav;
}
# BUFFERS TIMEOUTS UPLOAD SIZES
client_max_body_size 16400M;
client_body_buffer_size 1048576k;
send_timeout 3000;
# ENABLE GZIP BUT DO NOT REMOVE ETag HEADERS
gzip on;
gzip_vary on;
gzip_comp_level 4;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
location / {
rewrite ^ /index.php$uri;
}
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
deny all;
}
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
}
location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
fastcgi_keep_conn off;
fastcgi_buffers 16 256K;
fastcgi_buffer_size 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_send_timeout 3000s;
fastcgi_read_timeout 3000s;
fastcgi_connect_timeout 3000s;
}
location ~ ^/(?:updater|ocs-provider)(?:$|/) {
try_files $uri/ =404;
index index.php;
}
# ADDING THE CACHE CONTROL HEADER FOR JS AND CSS FILES
# MAKE SURE IT IS BELOW PHP BLOCK
location ~ \.(?:css|js|woff|svg|gif)$ {
try_files $uri /index.php$uri$is_args$args;
add_header Cache-Control "public, max-age=15778463";
# HEADERS SECURITY RELATED
# IT IS INTENDED TO HAVE THOSE DUPLICATED TO ONES ABOVE
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
# HEADERS
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
# OPTIONAL: DONT LOG ACCESS TO ASSETS
access_log off;
}
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
try_files $uri /index.php$uri$is_args$args;
# OPTIONAL: DONT LOG ACCESS TO OTHER ASSETS
access_log off;
}
}
}vi /usr/local/etc/php/ext-20-pgsql.ini[PostgresSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0vi /usr/local/etc/php/ext-30-pdo_pgsql.ini[PostgresSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0touch /var/log/php-fpm.log
chown www:www /var/log/php-fpm.log
rm /usr/local/etc/php-fpm.d/www.conf
vi /usr/local/etc/php-fpm.d/www.conf[www]
user = www
group = www
listen = /var/run/php-fpm.sock
listen.backlog = -1
listen.owner = www
listen.group = www
listen.mode=0660
pm = static
pm.max_children = 4
pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 4
pm.process_idle_timeout = 1000s;
pm.max_requests = 500
request_terminate_timeout = 0
rlimit_files = 51200
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmpvi /usr/local/etc/php.ini[PHP]
max_input_time=3600
engine = On
short_open_tag = On
precision = 14
output_buffering = OFF
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 17
disable_functions =
disable_classes =
zend.enable_gc = On
expose_php = On
max_execution_time = 3600
max_input_time = 30000
memory_limit = 1024M
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
html_errors = On
error_log = /var/log/php.log
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 16400M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
default_charset = "UTF-8"
doc_root =
user_dir =
enable_dl = Off
file_uploads = On
upload_max_filesize = 16400M
max_file_uploads = 64
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 300
[CLI Server]
cli_server.color = On
[Date]
date.timezone = America/Denver
[filter]
[iconv]
[intl]
[sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[Phar]
[mail function]
SMTP = localhost
smtp_port = 25
mail.add_x_header = On
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
[OCI8]
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[bcmath]
bcmath.scale = 0
[browscap]
[Session]
session.save_handler = files
session.save_path = "/tmp"
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[Assertion]
zend.assertions = -1
[COM]
[mbstring]
[gd]
[exif]
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[sysvshm]
[ldap]
ldap.max_links = -1
[mcrypt]
[dba]
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1
[curl]
[openssl]vi /etc/rc.conf# DAEMONS | yes
syslogd_flags="-s -s"
sshd_enable=YES
postgresql_enable=YES
postgresql_class=postgres
postgresql_data=/var/db/postgres/data
php_fpm_enable=YES
memcached_enable=YES
memcached_flags="-l 172.16.28.2"
nginx_enable=YES
# DAEMONS | no
sendmail_enable=NONE
sendmail_submit_enable=NO
sendmail_outbound_enable=NO
sendmail_msp_queue_enable=NO
# OTHER
clear_tmp_enable=YES
clear_tmp_X=YES
extra_netfs_types=NFS
dumpdev=NO
update_motd=NO
keyrate=fast/usr/local/etc/rc.d/memcached start
/usr/local/etc/rc.d/php-fpm start
/usr/local/etc/rc.d/postgresql status
/usr/local/etc/rc.d/nginx start
sockstat -l4
ls -l /var/run/php-fpm.sock
mkdir -p /var/db/nextcloud/data
chown -R www:www /var/db/nextcloud
chown -R www:www /usr/local/www/nextcloudvi /etc/newsyslog.conf/var/db/nextcloud/data/nextcloud.log www:www 640 7 * @T00 JC
/var/log/php-fpm.log www:www 640 7 * @T00 JC
/var/log/nginx/error.log www:www 640 7 * @T00 JC
/var/log/nginx/access.log www:www 640 7 * @T00 JC# find /var/db/pkg
/var/db/pkg
/var/db/pkg/FreeBSD.meta
/var/db/pkg/vuln.xml
/var/db/pkg/local.sqlite
/var/db/pkg/repo-FreeBSD.sqlite# pkg shell
-- Loading resources from /home/vermaden/.sqliterc
SQLite version 3.15.2 2016-11-28 19:13:37
Enter ".help" for usage hints.
> .q
## file /var/db/pkg/*
/var/db/pkg/FreeBSD.meta: ASCII text
/var/db/pkg/local.sqlite: SQLite 3.x database, user version 34, last written using SQLite version 3015002
/var/db/pkg/repo-FreeBSD.sqlite: SQLite 3.x database, user version 2014, last written using SQLite version 3015002
/var/db/pkg/vuln.xml: XML 1.0 document, UTF-8 Unicode text, with very long lines
# sqlite3 /var/db/pkg/local.sqlite
-- Loading resources from /home/vermaden/.sqliterc
SQLite version 3.26.0 2018-12-01 12:34:55
Enter ".help" for usage hints.
> .q
## pkg lock -l
Currently locked packages:
conky-1.9.0_6
exfat-utils-1.2.8
ffmpeg-4.1_1,1
fusefs-exfat-1.2.8
lame-3.100_2
# pkg delete exfat-utils
Checking integrity... done (0 conflicting)
The following package(s) are locked and may not be removed:
exfat-utils
1 packages requested for removal: 1 locked, 0 missing
# # pkg unlock exfat-utils
exfat-utils-1.2.8: unlock this package? [y/N]: y
Unlocking exfat-utils-1.2.8
# pkg lock -y exfat-utils
Locking exfat-utils-1.2.8# pkg search provides
pkg-provides-0.5.0 Pkg plugin for querying which package provides a particular file
# pkg install pkg-provides
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
pkg-provides: 0.5.0 [FreeBSD]
Number of packages to be installed: 1
10 KiB to be downloaded.
Proceed with this action? [y/N]: y
[1/1] Fetching pkg-provides-0.5.0.txz: 100% 10 KiB 9.8kB/s 00:01
Checking integrity... done (0 conflicting)
[1/1] Installing pkg-provides-0.5.0...
[1/1] Extracting pkg-provides-0.5.0: 100%
Message from pkg-provides-0.5.0:
======================= pkg plugin activation ========================
In order to use the pkg-provides plugin you need to enable plugins in pkg.
To do this, uncomment the following lines in /usr/local/etc/pkg.conf file
and add pkg-provides to the supported plugin list
PKG_PLUGINS_DIR = "/usr/local/lib/pkg/";
PKG_ENABLE_PLUGINS = true;
PLUGINS [ provides ];
After that run `pkg plugins' to see the plugins handled by pkg`.
To update the provides database run `pkg provides -u`
====================================================================# cat << __EOF__ >> /usr/local/etc/pkg.conf
PKG_PLUGINS_DIR = "/usr/local/lib/pkg/";
PKG_ENABLE_PLUGINS = true;
PLUGINS [ provides ];
__EOF__# pkg provides
usage: pkg provides [-uf] pattern
A plugin for querying which package provides a particular file
# pkg provides bin/pldd
Provides database not found, please update first.# pkg provides -u
Fetching provides database: 100% 29 MiB 700.9kB/s 00:43
Extracting database....success# pkg provides bin/pldd
Name : ptools2-0.5
Desc : Toolset based on Solaris ptools functionality
Repo : FreeBSD
Filename: /usr/local/bin/pldd
Name : linux_base-c7-7.4.1708_6
Desc : Base set of packages needed in Linux mode (Linux CentOS 7.4.1708)
Repo : FreeBSD
Filename: /compat/linux/usr/bin/pldd
# pkg install /compat/linux/usr/bin/pldd
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
pkg: No packages available to install matching '/compat/linux/usr/bin/pldd' have been found in the repositories# pkg upgrade
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100% 944 B 0.9kB/s 00:01
Fetching packagesite.txz: 100% 6 MiB 376.5kB/s 00:18
Processing entries: 100%
Fetching provides database: 100% 29 MiB 386.3kB/s 01:18
Extracting database....success
FreeBSD repository update completed. 32542 packages processed.
All repositories are up to date.
Checking integrity... done (0 conflicting)
(...)# file /var/db/pkg/* /var/db/pkg/*/* | sort -n
/var/db/pkg/FreeBSD.meta: ASCII text
/var/db/pkg/local.sqlite: SQLite 3.x database, user version 34, last written using SQLite version 3015002
/var/db/pkg/provides: directory
/var/db/pkg/provides/provides.db: ASCII text
/var/db/pkg/repo-FreeBSD.sqlite: SQLite 3.x database, user version 2014, last written using SQLite version 3015002
/var/db/pkg/vuln.xml: XML 1.0 document, UTF-8 Unicode text, with very long lines# du -csm /var/db/pkg/*
1 /var/db/pkg/FreeBSD.meta
32 /var/db/pkg/local.sqlite
72 /var/db/pkg/provides
33 /var/db/pkg/repo-FreeBSD.sqlite
2 /var/db/pkg/vuln.xml
138 total# du -csmA /var/db/pkg/*
1 /var/db/pkg/FreeBSD.meta
68 /var/db/pkg/local.sqlite
571 /var/db/pkg/provides
52 /var/db/pkg/repo-FreeBSD.sqlite
6 /var/db/pkg/vuln.xml
694 total# pkg which /boot/modules/drm.ko
/boot/modules/drm.ko was installed by package drm-fbsd11.2-kmod-4.11g20181210
# pkg which /boot/kernel/drm.ko
/boot/kernel/drm.ko was not found in the database# which firefox
/usr/local/bin/firefox
# pkg which `which firefox`
/usr/local/bin/firefox was installed by package firefox-64.0.2,1# pkg install parallel
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
pkg: Cannot get an advisory lock on a database, it is locked by another process# ps ax | grep pkg
8540 - S 0:00.00 /bin/sh - /usr/local/etc/periodic/daily/411.pkg-backup
8551 - S 0:00.00 /usr/local/sbin/pkg shell .dump
8555 - D 0:01.08 /usr/local/sbin/pkg shell .dump# find /etc/periodic /usr/local/etc/periodic -name \*pkg\*
/usr/local/etc/periodic/daily/490.status-pkg-changes
/usr/local/etc/periodic/daily/411.pkg-backup
/usr/local/etc/periodic/security/460.pkg-checksum
/usr/local/etc/periodic/security/410.pkg-audit
/usr/local/etc/periodic/weekly/400.status-pkg# find /etc/periodic /usr/local/etc/periodic -name \*pkg\* | xargs grep -m 1 -E -o "[a-z_]+_enable"
/usr/local/etc/periodic/daily/490.status-pkg-changes:daily_status_pkgng_changes_enable
/usr/local/etc/periodic/daily/411.pkg-backup:daily_backup_pkgng_enable
/usr/local/etc/periodic/security/460.pkg-checksum:security_status_pkgchecksum_enable
/usr/local/etc/periodic/security/410.pkg-audit:security_status_pkgaudit_enable
/usr/local/etc/periodic/weekly/400.status-pkg:weekly_status_pkgng_enable# ps ax | grep pkg
8574 0 S+ 0:00.00 grep --color pkg# pkg install parallel
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
parallel: 20171222
Number of packages to be installed: 1
The process will require 3 MiB more space.
1 MiB to be downloaded.
Proceed with this action? [y/N]: n
## pkg stats
Local package database:
Installed packages: 1081
Disk space occupied: 9 GiB
Remote package database(s):
Number of repositories: 1
Packages available: 32518
Unique packages: 32518
Total size of packages: 78 GiB# pkg size | head
10.5MiB
2.06MiB
27.4MiB
2.59MiB
5.17MiB
515KiB
23.2MiB
609KiB
587KiB
127KiB# man pkg-size
No manual entry for pkg-size# alias pkg-size='pkg info -as | sort -k 2 -h | tail -20 | column -t'
# which pkg-size
pkg-size: aliased to pkg info -as | sort -k 2 -h | tail -20 | column -t
# pkg-size
python27-2.7.15 68.2MiB
gtk3-3.22.30_4 68.8MiB
opencollada-1.6.68_1 75.8MiB
py27-ansible-2.7.5 88.6MiB
argyllcms-1.9.2_4 92.4MiB
webkit2-gtk3-2.22.5 92.9MiB
gimp-app-2.10.8_1,1 95.4MiB
python36-3.6.8 104MiB
samba47-4.7.12 145MiB
openjdk8-8.192.26_3 162MiB
boost-libs-1.69.0 163MiB
thunderbird-60.4.0_1 167MiB
firefox-64.0.2,1 174MiB
binutils-2.30_7,1 195MiB
linux_base-c6-6.10 197MiB
gcc6-6.5.0_3 241MiB
chromium-71.0.3578.98_2 251MiB
libreoffice-6.0.7_4 353MiB
virtualbox-ose-5.2.22_2 375MiB
llvm60-6.0.1_5 818MiB# pkg autor
# pkg upg
# pkg inf# pkg update -f
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100% 944 B 0.9kB/s 00:01
Fetching packagesite.txz: 100% 6 MiB 352.9kB/s 00:19
Processing entries: 100%
Fetching provides database: 100% 28 MiB 658.3kB/s 00:44
Extracting database....success
FreeBSD repository update completed. 31778 packages processed.
All repositories are up to date.# portmaster --check-depends
(...)
Checking dependencies: evince
graphics/evince has a missing dependency: www/libxul19
(...)
>>> Missing package dependencies were detected.
>>> Found 1 issue(s) in total with your package database.
The following packages will be installed:
Downgrading perl: 5.14.2_3 -> 5.14.2_2
Downgrading glib: 2.34.3 -> 2.28.8_5
Downgrading gio-fam-backend: 2.34.3 -> 2.28.8_1
Downgrading libffi: 3.0.12 -> 3.0.11
Downgrading gobject-introspection: 1.34.2 -> 0.10.8_3
Downgrading atk: 2.6.0 -> 2.0.1
Downgrading gdk-pixbuf2: 2.26.5 -> 2.23.5_3
Downgrading pango: 1.30.1 -> 1.28.4_1
Downgrading gtk-update-icon-cache: 2.24.17 -> 2.24.6_1
Downgrading dbus: 1.6.8 -> 1.4.14_4
Downgrading gtk: 2.24.17 -> 2.24.6_2
Downgrading dbus-glib: 0.100.1 -> 0.94
Installing libxul: 1.9.2.28_1
The installation will require 66 MB more space
38 MB to be downloaded
>>> Try to fix the missing dependencies [y/N]: n
>>> Summary of actions performed:
www/libxul19 dependency failed to be fixed
>>> There are still missing dependencies.
>>> You are advised to try fixing them manually.
>>> Also make sure to check 'pkg updating' for known issues.# pkg info | grep libxul
libxul-10.0.12 Mozilla runtime package that can be used to bootstrap XUL+XPCOM apps
# pkg info -qoa | grep libxul
www/libxul# pkg shell
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .databases
seq name file
--- --------------- ----------------------------------------------------------
0 main /var/db/pkg/local.sqlite
sqlite> .tables
categories licenses pkg_directories scripts
deps mtree pkg_groups shlibs
directories options pkg_licenses users
files packages pkg_shlibs
groups pkg_categories pkg_users
sqlite> .header on
sqlite> .mode column
sqlite> pragma table_info(deps);
cid name type notnull dflt_value pk
---------- ---------- ---------- ---------- ---------- ----------
0 origin TEXT 1 1
1 name TEXT 1 0
2 version TEXT 1 0
3 package_id INTEGER 0 1
sqlite> .quit# sqlite3 -column /var/db/pkg/local.sqlite "select * from deps;" | grep libxul
www/libxul19 libxul 1.9.2.28_1 104sqlite3 -header -column /var/db/pkg/local.sqlite "select * from deps where name='libxul';"
origin name version package_id
------------ ---------- ---------- ----------
www/libxul19 libxul 1.9.2.28_1 104# sqlite3 /var/db/pkg/local.sqlite "update deps set origin='www/libxul' where name='libxul';"
# sqlite3 /var/db/pkg/local.sqlite "update deps set version='10.0.12' where name='libxul';"# pkg shell
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> update deps set origin='www/libxul' where name='libxul';
sqlite> update deps set version='10.0.12' where name='libxul';
sqlite> .header on
sqlite> .mode column
sqlite> select * from deps where name='libxul';
origin name version package_id
---------- ---------- ---------- ----------
www/libxul libxul 10.0.12 104
sqlite> .quit# portmaster --check-depends
(...)
Checking dependencies: zenity
Checking dependencies: zip
Checking dependencies: zsh
# -n oldname:newname, --change-name oldname:newname
Change the package name of a given dependency from oldname to newname.
将指定依赖项的包名从 `oldname` 修改为 `newname`。
(...)
-o oldorigin:neworigin, --change-origin oldorigin:neworigin
Change the port origin of a given dependency from oldorigin to neworigin.
This corresponds to the port directory that the package originated from.
Typically, this is only needed for upgrading a library or package that
has MOVED or when the default version of a major port dependency changes.
(DEPRECATED) Usually this will be explained in /usr/ports/UPDATING.
Also see pkg-updating(8) and EXAMPLES.
将指定依赖项的 Port 来源从 oldorigin 修改为 neworigin。
这对应于该包最初来源的 Port 目录。通常,仅在升级已被 MOVED 的库或包,或者主要 Port 依赖的默认版本发生变化时才需要使用此功能。(已弃用)通常相关说明会在 /usr/ports/UPDATING 中给出。
另请参见 pkg-updating(8) 和示例。# less /usr/ports/UPDATING
(...)
20180518:
AFFECTS: users of sysutils/ansible*
AUTHOR: [email protected]
Ansible ports are now flavored. Package names for Ansible changed
to include python version. Poudriere and package users don't need
to do anything.
To rename an installed package to match the new naming scheme,
for example, for ansible24, run:
# pkg set -n ansible24:py27-ansible24
(...)
20180214:
AFFECTS: users of lang/ruby23
AUTHOR: [email protected]
The default ruby version has been updated from 2.3 to 2.4.
If you compile your own ports you may keep 2.3 as the default version by
adding the following lines to your /etc/make.conf file:
#
# Keep ruby 2.3 as default version
#
DEFAULT_VERSIONS+=ruby=2.3
If you wish to update to the new default version, you need to first stop any
software that uses ruby. Then, you will need to follow these steps, depending
upon how you manage your system.
If you use pkgng, simply upgrade:
# pkg upgrade
If you use portmaster, install new ruby, then rebuild all ports that depend
on ruby:
# portmaster -o lang/ruby24 lang/ruby23
# portmaster -R -r ruby-2.4
If you use portupgrade, install new ruby, then rebuild all ports that depend
on ruby:
# pkg delete -f ruby portupgrade
# make -C /usr/ports/ports-mgmt/portupgrade install clean
# pkg set -o lang/ruby23:lang/ruby24
# portupgrade -x ruby-2.4.\* -fr lang/ruby24
(...)# pkg updating -d 20190101
20190103:
AFFECTS: users of multimedia/vlc*
AUTHOR: [email protected]
The multimedia/vlc port has been upgraded to 3.0.5, the latest upstream
release. Subsequently, multimedia/vlc-qt4 and multimedia/vlc3 have been
retired and removed from the ports tree. Users who previously used
multimedia/vlc3 might want to switch to multimedia/vlc with the following
commands:
# pkg install multimedia/vlc
or
# portmaster -o multimedia/vlc multimedia/vlc3
or
# portupgrade -o multimedia/vlc multimedia/vlc3# beadm create safepoint
Created successfully
# beadm list
BE Active Mountpoint Space Created
11.2-RELEASE NR / 5.7G 2018-12-01 13:09
safepoint - - 316.0K 2019-01-16 23:03
# pkg upgrade# pkg info -r sqlite3
sqlite3-3.26.0:
colord-gtk-0.1.26
py27-sqlite3-2.7.15_7
freeciv-2.5.10
colord-1.3.5
libsoup-2.62.3
libsoup-gnome-2.62.3
subversion-1.11.0_1
nss-3.41_1
webkit-gtk2-2.4.11_19
filezilla-3.36.0_1
epiphany-3.28.5_1
darktable-2.4.4_3
aria2-1.34.0_1
webkit2-gtk3-2.22.5
qt5-webkit-5.212.0.a2_17
qt5-sqldrivers-sqlite3-5.12.0
hugin-2018.0.0_6
pidgin-2.13.0
thunderbird-60.4.0_1
midori-0.7.0
firefox-64.0.2,1
# pkg query -e '%n = sqlite3' %ro
graphics/colord-gtk
databases/py-sqlite3
games/freeciv
graphics/colord
devel/libsoup
devel/libsoup-gnome
devel/subversion
security/nss
www/webkit-gtk2
ftp/filezilla
www/epiphany
graphics/darktable
www/aria2
www/webkit2-gtk3
www/qt5-webkit
databases/qt5-sqldrivers-sqlite3
graphics/hugin
net-im/pidgin
mail/thunderbird
www/midori
www/firefox# pkg query "%t %n-%v" \
| sort -n \
| while read timestamp pkgname
do
echo "$(date -r $timestamp) $pkgname"
done | ( head; echo; tail )
Fri Jul 7 14:17:29 CEST 2017 libpciaccess-0.13.5
Fri Jul 7 14:17:35 CEST 2017 libedit-3.1.20170329_2,1
Fri Jul 7 14:18:09 CEST 2017 font-util-1.3.1
Fri Jul 7 14:18:10 CEST 2017 xcb-util-0.4.0_2,1
Fri Jul 7 15:26:56 CEST 2017 xcb-util-renderutil-0.3.9_1
Fri Jul 7 15:26:57 CEST 2017 dejavu-2.37
Fri Jul 7 15:27:00 CEST 2017 font-misc-meltho-1.0.3_3
Fri Jul 7 15:27:02 CEST 2017 font-misc-ethiopic-1.0.3_3
Fri Jul 7 15:27:06 CEST 2017 font-bh-ttf-1.0.3_3
Fri Jul 7 15:27:08 CEST 2017 tpm-emulator-0.7.4_2
Sun Jan 13 20:48:01 CET 2019 firefox-64.0.2,1
Sun Jan 13 20:48:01 CET 2019 htop-2.2.0_1
Wed Jan 16 23:08:21 CET 2019 vlc-3.0.6,4
Wed Jan 16 23:08:21 CET 2019 xdg-utils-1.1.3
Wed Jan 16 23:08:25 CET 2019 phonon-qt4-4.10.2
Wed Jan 16 23:08:25 CET 2019 physfs-3.0.1
Wed Jan 16 23:08:25 CET 2019 py27-pyasn1-0.4.5
Wed Jan 16 23:08:26 CET 2019 chromium-71.0.3578.98_2
Wed Jan 16 23:08:26 CET 2019 moreutils-0.63
Wed Jan 16 23:08:26 CET 2019 p5-URI-1.76# pkg query -e "%a != 1" "%n" | tail
xmp
xorg
xprintidle
xterm
xxkb
youtube_dl
zenity
zfs-stats
zip
zsh% acpiconf -i 0
Design capacity: 44000 mWh
Last full capacity: 37930 mWh
Technology: secondary (rechargeable)
Design voltage: 11100 mV
Capacity (warn): 1896 mWh
Capacity (low): 200 mWh
Low/warn granularity: 1 mWh
Warn/full granularity: 1 mWh
Model number: 45N1037
Serial number: 28608
Type: LION
OEM info: SANYO
State: high
Remaining capacity: 100%
Remaining time: unknown
Present rate: 0 mW
Present voltage: 12495 mV% acpiconf -i 0
Design capacity: 44000 mWh
Last full capacity: 37930 mWh
Technology: secondary (rechargeable)
Design voltage: 11100 mV
Capacity (warn): 1896 mWh
Capacity (low): 200 mWh
Low/warn granularity: 1 mWh
Warn/full granularity: 1 mWh
Model number: 45N1037
Serial number: 28608
Type: LION
OEM info: SANYO
State: high
Remaining capacity: 100%
Remaining time: 2:31
Present rate: 0 mW
Present voltage: 12492 mV% acpiconf -i 1
Design capacity: 31320 mWh
Last full capacity: 24510 mWh
Technology: secondary (rechargeable)
Design voltage: 10800 mV
Capacity (warn): 1225 mWh
Capacity (low): 200 mWh
Low/warn granularity: 1 mWh
Warn/full granularity: 1 mWh
Model number: 45N1041
Serial number: 260
Type: LiP
OEM info: SONY
State: high
Remaining capacity: 100%
Remaining time: unknown
Present rate: 0 mW
Present voltage: 12082 mV% acpiconf -i 1
Design capacity: 31320 mWh
Last full capacity: 24510 mWh
Technology: secondary (rechargeable)
Design voltage: 10800 mV
Capacity (warn): 1225 mWh
Capacity (low): 200 mWh
Low/warn granularity: 1 mWh
Warn/full granularity: 1 mWh
Model number: 45N1041
Serial number: 260
Type: LiP
OEM info: SONY
State: discharging
Remaining capacity: 98%
Remaining time: 1:36
Present rate: 14986 mW
Present voltage: 11810 mV% sysctl hw.acpi.battery.time
hw.acpi.battery.time: 247% sysctl hw.acpi.battery
hw.acpi.battery.info_expire: 5
hw.acpi.battery.units: 2
hw.acpi.battery.state: 1
hw.acpi.battery.time: 247
hw.acpi.battery.life: 99% sysctl hw.acpi.battery
hw.acpi.battery.info_expire: 5
hw.acpi.battery.units: 2
hw.acpi.battery.state: 0
hw.acpi.battery.time: -1
hw.acpi.battery.life: 100% battery-capacity.sh 0
Battery '0' model '45N1037' has efficiency: 86%
% battery-capacity.sh 1
Battery '1' model '45N1041' has efficiency: 78%#! /bin/sh
if [ ${#} -ne 1 ]
then
echo "usage: ${0##*/} BATTERY"
exit
fi
if acpiconf -i ${1} 1> /dev/null 2> /dev/null
then
DATA=$( acpiconf -i ${1} )
MAX=$( echo "${DATA}" | grep '^Design\ capacity:' | awk -F ':' '{print $2}' | tr -c -d '0-9' )
NOW=$( echo "${DATA}" | grep '^Last\ full\ capacity:' | awk -F ':' '{print $2}' | tr -c -d '0-9' )
MOD=$( echo "${DATA}" | grep '^Model\ number:' | awk -F ':' '{print $2}' | awk '{print $1}' )
echo -n "Battery '${1}' model '${MOD}' has efficiency: "
printf '%1.0f%%\n' $( bc -l -e "scale = 2; ${NOW} / ${MAX} * 100" -e quit )
else
echo "NOPE: Battery '${1}' does not exists on this system."
echo "INFO: Most systems has only '0' or '1' batteries."
exit 1
fi% sysctl dev.cpu.0
dev.cpu.0.cx_method: C1/hlt C2/io
dev.cpu.0.cx_usage_counters: 412905 0
dev.cpu.0.cx_usage: 100.00% 0.00% last 290us
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_supported: C1/1/1 C2/3/104
dev.cpu.0.freq_levels: 2501/35000 2500/35000 2200/29755 2000/26426 1800/23233 1600/20164 1400/17226 1200/14408 1000/11713 800/9140
dev.cpu.0.freq: 800
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%location: handle=\_PR_.CPU0
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU% sysctl dev.cpu.0
dev.cpu.0.temperature: 49.0C
dev.cpu.0.coretemp.throttle_log: 0
dev.cpu.0.coretemp.tjmax: 100.0C
dev.cpu.0.coretemp.resolution: 1
dev.cpu.0.coretemp.delta: 51
dev.cpu.0.cx_method: C1/hlt C2/io
dev.cpu.0.cx_usage_counters: 16549 0
dev.cpu.0.cx_usage: 100.00% 0.00% last 1489us
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_supported: C1/1/1 C2/3/104
dev.cpu.0.freq_levels: 2501/35000 2500/35000 2200/29755 2000/26426 1800/23233 1600/20164 1400/17226 1200/14408 1000/11713 800/9140
dev.cpu.0.freq: 800
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%location: handle=\_PR_.CPU0
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU% sysctl hw.acpi.thermal.tz0.temperature
hw.acpi.thermal.tz0.temperature: 49.1C% grep FreeBSD/SMP /var/run/dmesg.boot
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
FreeBSD/SMP: 1 package(s) x 2 core(s)
% sysctl kern.smp.cpus
kern.smp.cpus: 2% sysctl -d dev.cpu.0.freq
dev.cpu.0.freq: Current CPU frequency# pkg install lscpu# kldload cpuctl
# lscpu
Architecture: amd64
Byte Order: Little Endian
Total CPU(s): 2
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 0
Vendor: GenuineIntel
CPU family: 6
Model: 42
Model name: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz
Stepping: 7
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3M
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 cflsh ds acpi mmx fxsr sse sse2 ss htt tm pbe sse3 pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline aes xsave osxsave avx syscall nx rdtscp lm lahf_lm% grep CPU /var/run/dmesg.boot
CPU: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz (2491.97-MHz K8-class CPU)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
cpu0: on acpi0
coretemp0: on cpu0powerd_enable=YES
powerd_flags="-n adaptive -a hiadaptive -b adaptive -m 800 -M 1600"# pkg install powerdxxpowerdxx_enable=YES
powerdxx_flags="-n adaptive -a hiadaptive -b adaptive -m 800 -M 1600"% tail -f /var/log/messages
Nov 28 13:14:42 t420s power_profile[48231]: changed to 'economy'
Nov 28 13:14:46 t420s power_profile[56835]: changed to 'performance'performance_cx_lowest=C1
economy_cx_lowest=Cmax% sysctl dev.cpu.0.cx_supported
dev.cpu.0.cx_supported: C1/1/1 C2/3/104% grep cx_lowest /etc/sysctl.conf
dev.cpu.0.cx_lowest=C1
dev.cpu.1.cx_lowest=C3
dev.cpu.2.cx_lowest=C3
dev.cpu.3.cx_lowest=C3% sysctl dev.cpu.0.freq_levels
dev.cpu.0.freq_levels: 2501/35000 2500/35000 2200/29755 2000/26426 1800/23233 1600/20164 1400/17226 1200/14408 1000/11713 800/9140# sysctl dev.cpu.0.freq=2501/35000
sysctl: invalid integer '2501/35000'# sysctl dev.cpu.0.freq=2501
dev.cpu.0.freq: 800 -> 2501% usbconfig
ugen1.1: at usbus1, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen2.1: at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.1: at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen2.2: at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.2: at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.3: at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen2.3: at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)# usbconfig -u 1 -a 1 power_save% grep -A 10 POWER /etc/rc.local
# POWER SAVE USB DEVICES
usbconfig \
| grep -v 'Lenovo USB Receiver' \
| grep -v 'Unifying Receiver Logitech' \
| awk '{print $1}' \
| sed 's|ugen||'g \
| tr -d : \
| awk -F '.' '{print $1 " " $2 }' \
| while read U A
do
usbconfig -u ${U} -a ${A} power_save 2> /dev/null
done% grep ahcich /var/run/dmesg.boot
ahcich0: at channel 0 on ahci0
ahcich1: at channel 1 on ahci0
ahcich4: at channel 4 on ahci0
ada0 at ahcich0 bus 0 scbus0 target 0 lun 0 hint.ahcich.X.pm_level
controls SATA interface Power Management for the specified channel,
allowing some power to be saved at the cost of additional command latency.
Some controllers, such as ICH8, do not implement modes 2 and 3 with NCQ
used. Because of artificial entering latency, performance degradation in
modes 4 and 5 is much smaller then in modes 2 and 3.
控制指定通道的 SATA 接口电源管理,可以在牺牲额外命令延迟的情况下节省一些电量。
一些控制器(例如 ICH8)在用 NCQ 时不支持模式 2 和 3。
由于人工进入延迟,模式 4 和 5 的性能下降远小于模式 2 和 3。
# AHCI POWER MANAGEMENT FOR EVERY USED CHANNEL (ahcich 0-7)
hint.ahcich.0.pm_level=5
hint.ahcich.1.pm_level=5
hint.ahcich.2.pm_level=5
hint.ahcich.3.pm_level=5
hint.ahcich.4.pm_level=5
hint.ahcich.5.pm_level=5
hint.ahcich.6.pm_level=5
hint.ahcich.7.pm_level=5 hw.pci.do_power_nodriver (Defaults to 0)
Place devices into a low power state (D3) when
a suitable device driver is not found.
当未找到合适的设备驱动时,将设备置于低功耗状态(D3)。# POWER OFF DEVICES WITHOUT ATTACHED DRIVER
hw.pci.do_power_nodriver=3% pciconf -l
hostb0@pci0:0:0:0: class=0x060000 card=0x21d217aa chip=0x01048086 rev=0x09 hdr=0x00
vgapci0@pci0:0:2:0: class=0x030000 card=0x21d217aa chip=0x01268086 rev=0x09 hdr=0x00
none0@pci0:0:22:0: class=0x078000 card=0x21d217aa chip=0x1c3a8086 rev=0x04 hdr=0x00
em0@pci0:0:25:0: class=0x020000 card=0x21ce17aa chip=0x15028086 rev=0x04 hdr=0x00
ehci0@pci0:0:26:0: class=0x0c0320 card=0x21d217aa chip=0x1c2d8086 rev=0x04 hdr=0x00
hdac0@pci0:0:27:0: class=0x040300 card=0x21d217aa chip=0x1c208086 rev=0x04 hdr=0x00
pcib1@pci0:0:28:0: class=0x060400 card=0x21d217aa chip=0x1c108086 rev=0xb4 hdr=0x01
pcib2@pci0:0:28:1: class=0x060400 card=0x21d217aa chip=0x1c128086 rev=0xb4 hdr=0x01
pcib3@pci0:0:28:3: class=0x060400 card=0x21d217aa chip=0x1c168086 rev=0xb4 hdr=0x01
pcib4@pci0:0:28:4: class=0x060400 card=0x21d217aa chip=0x1c188086 rev=0xb4 hdr=0x01
ehci1@pci0:0:29:0: class=0x0c0320 card=0x21d217aa chip=0x1c268086 rev=0x04 hdr=0x00
isab0@pci0:0:31:0: class=0x060100 card=0x21d217aa chip=0x1c4f8086 rev=0x04 hdr=0x00
ahci0@pci0:0:31:2: class=0x010601 card=0x21d217aa chip=0x1c038086 rev=0x04 hdr=0x00
ichsmb0@pci0:0:31:3: class=0x0c0500 card=0x21d217aa chip=0x1c228086 rev=0x04 hdr=0x00
iwn0@pci0:3:0:0: class=0x028000 card=0x11118086 chip=0x42388086 rev=0x3e hdr=0x00
sdhci_pci0@pci0:5:0:0: class=0x088000 card=0x21d217aa chip=0xe8221180 rev=0x07 hdr=0x00
xhci0@pci0:13:0:0: class=0x0c0330 card=0x01941033 chip=0x01941033 rev=0x04 hdr=0x00% pciconf -l -v
(...)
xhci0@pci0:13:0:0: class=0x0c0330 card=0x01941033 chip=0x01941033 rev=0x04 hdr=0x00
vendor = 'NEC Corporation'
device = 'uPD720200 USB 3.0 Host Controller'
class = serial bus
subclass = USB# mkdir /root/bin
# cd /root/bin
# fetch https://people.freebsd.org/~xmj/turn_off_gpu.sh
# pkg install acpi_call
# kldload acpi_call
# chmod +x /root/bin/turn_off_gpu.sh
# /root/bin/turn_off_gpu.sh# DISABLE NVIDIA CARD
/root/bin/turn_off_gpu.sh% sysctl hw.acpi.supported_sleep_state
hw.acpi.supported_sleep_state: S3 S4 S5# zzz# acpiconf -s 3# kldload acpi_ibm% sysctl dev.acpi_ibm
dev.acpi_ibm.0.handlerevents: NONE
dev.acpi_ibm.0.mic_led: 0
dev.acpi_ibm.0.fan: 0
dev.acpi_ibm.0.fan_level: 0
dev.acpi_ibm.0.fan_speed: 0
dev.acpi_ibm.0.wlan: 1
dev.acpi_ibm.0.bluetooth: 0
dev.acpi_ibm.0.thinklight: 0
dev.acpi_ibm.0.mute: 0
dev.acpi_ibm.0.volume: 0
dev.acpi_ibm.0.lcd_brightness: 0
dev.acpi_ibm.0.hotkey: 1425
dev.acpi_ibm.0.eventmask: 134217727
dev.acpi_ibm.0.events: 1
dev.acpi_ibm.0.availmask: 134217727
dev.acpi_ibm.0.initialmask: 2060
dev.acpi_ibm.0.%parent: acpi0
dev.acpi_ibm.0.%pnpinfo: _HID=LEN0068 _UID=0
dev.acpi_ibm.0.%location: handle=\_SB_.PCI0.LPC_.EC__.HKEY
dev.acpi_ibm.0.%driver: acpi_ibm
dev.acpi_ibm.0.%desc: IBM ThinkPad ACPI Extras
dev.acpi_ibm.%parent:#! /bin/sh
if ! kldstat | grep -q acpi_ibm.ko
then
doas kldload acpi_ibm
fi
doas sysctl dev.acpi_ibm.0.fan=0 1> /dev/null
TEMP=$( sysctl -n hw.acpi.thermal.tz0.temperature | awk -F'.' '{print $1}' )
if [ ${TEMP} -lt 50 ]
then
doas sysctl dev.acpi_ibm.0.fan_level=0 1> /dev/null
exit 0
fi
if [ ${TEMP} -lt 60 ]
then
doas sysctl dev.acpi_ibm.0.fan_level=1 1> /dev/null
exit 0
fi
if [ ${TEMP} -ge 60 ]
then
doas sysctl dev.acpi_ibm.0.fan_level=3 1> /dev/null
exit 0
fi% crontab -l
# ACPI/IBM/FAN
* * * * * ~/scripts/acpi-thinkpad-fan.sh# ifconfig wlan0 powersave# pkg install powermon
# kldload cpuctl
# powermon
Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz
(Arch: Sandy Bridge, Limit: 44W)
5.11W [=======> ]
Package: Uncore: x86 Cores: GPU:
Current: 5.11W Current: 3.17W Current: 1.73W Current: 0.21W
Total: 98.33J Total: 60.86J Total: 33.49J Total: 3.98J# pkg install dtrace-toolkit# /usr/local/share/dtrace-toolkit/execsnoop
UID PID PPID ARGS
1000 97748 97509 /usr/local/bin/zsh -c ~/scripts/dzen2-update.sh > ~/.dzen2-fifo
1000 97748 1 /bin/sh /home/vermaden/scripts/dzen2-update.sh
1000 99157 97748 sysctl -n kern.smp.cpus
1000 311 97748 ps ax -o %cpu,rss,command -c
1000 3118 1521 awk -v SMP=200 /\ idle$/ {printf("%.1f%%",SMP-$1)}
1000 4462 97748 date +%Y/%m/%d/%a/%H:%M
1000 4801 97748 sysctl -n dev.cpu.0.freq
1000 6009 97748 sysctl -n hw.acpi.thermal.tz0.temperature
1000 6728 97748 sysctl -n vm.stats.vm.v_inactive_count
1000 7043 97748 sysctl -n vm.stats.vm.v_free_count
1000 7482 97748 sysctl -n vm.stats.vm.v_cache_count
1000 10363 8568 bc -l
1000 10863 10363 dc -x
1000 13143 7773 grep --color -q ^\.
1000 13798 97748 /bin/sh /home/vermaden/scripts/__conky_if_ip.sh
1000 15089 14235 ifconfig -u
1000 16439 14235 grep -v 127.0.0.1
1000 17738 14235 grep -c inet
1000 19069 18612 ifconfig -l -u
1000 19927 18612 sed s/lo0//g
1000 20772 13798 ifconfig wlan0
1000 23388 21410 grep ssid
1000 24588 13798 grep -q "
1000 25965 25282 awk /ssid/ {print $2}
1000 27917 27217 awk /inet / {print $2}
1000 29941 97748 /bin/sh /home/vermaden/scripts/__conky_if_gw.sh
1000 32808 31412 route -n -4 -v get default
1000 34012 31412 awk END{print $2}
1000 34895 97748 /bin/sh /home/vermaden/scripts/__conky_if_dns.sh
1000 36118 34895 awk /^nameserver/ {print $2; exit} /etc/resolv.conf
1000 37628 97748 /bin/sh /home/vermaden/scripts/__conky_if_ping.sh dzen2
1000 38829 37628 ping -c 1 -s 0 -t 1 -q 9.9.9.9
1000 42079 41566 mixer -s vol
1000 42177 41566 awk -F : {printf("%s",$2)}
1000 44434 43254 zfs list -H -d 0 -o name,avail
1000 45866 43254 awk {printf("%s/%s ",$1,$2)}
1000 47004 97748 /bin/sh /home/vermaden/scripts/__conky_battery_separate.sh dzen2
1000 48282 47004 sysctl -n hw.acpi.battery.units
1000 49494 47004 sysctl -n hw.acpi.battery.life
1000 49948 47004 sysctl -n hw.acpi.acline
1000 52073 51441 acpiconf -i 0
1000 53055 51441 awk /^State:/ {print $2}
1000 53981 53186 acpiconf -i 0
1000 55354 53186 awk /^Remaining capacity:/ {print $3}
1000 55968 55631 acpiconf -i 1
1000 57187 55631 awk /^State:/ {print $2}
1000 58405 57471 acpiconf -i 1
1000 59201 57471 awk /^Remaining capacity:/ {print $3}
1000 60961 59252 bsdgrep -v -E (COMMAND|idle)$
1000 63534 59252 head -3
1000 62194 59252 sort -r -n
1000 64629 59252 awk {printf("%s/%d%%/%.1fGB ",$3,$1,$2/1024/1024)}
1000 64634 93198 tail -1 /home/vermaden/.dzen2-fifo# 使用 graphics/drm-kmod 包的 INTEL DRM(新)
# 启动时跳过不必要的模式设置
compat.linuxkpi.fastboot=1
# 使用信号量进行环间同步
compat.linuxkpi.semaphores=1
# 启用渲染 C 状态 6 节能
compat.linuxkpi.enable_rc6=7
# 启用显示 C 状态节能
compat.linuxkpi.enable_dc=2
# 启用帧缓冲压缩以节能
compat.linuxkpi.enable_fbc=1# 使用 graphics/drm-kmod 包的 INTEL DRM(旧)
drm.i915.enable_rc6=7
drm.i915.semaphores=1
drm.i915.intel_iommu_enabled=1machdep.hwpstate_pkg_ctrl=0dev.hwpstate_intel.N.epp=Ydev.hwpstate_intel.0.epp=100
dev.hwpstate_intel.1.epp=100
dev.hwpstate_intel.2.epp=100
dev.hwpstate_intel.3.epp=100
dev.hwpstate_intel.4.epp=100
dev.hwpstate_intel.5.epp=100
dev.hwpstate_intel.6.epp=100
dev.hwpstate_intel.7.epp=100dev.hwpstate_intel.0.epp=0
dev.hwpstate_intel.1.epp=50
dev.hwpstate_intel.2.epp=100
dev.hwpstate_intel.3.epp=100
dev.hwpstate_intel.4.epp=100
dev.hwpstate_intel.5.epp=100
dev.hwpstate_intel.6.epp=100
dev.hwpstate_intel.7.epp=100dev.hwpstate_intel.0.epp=0
dev.hwpstate_intel.1.epp=0
dev.hwpstate_intel.2.epp=0
dev.hwpstate_intel.3.epp=0
dev.hwpstate_intel.4.epp=0
dev.hwpstate_intel.5.epp=0
dev.hwpstate_intel.6.epp=0
dev.hwpstate_intel.7.epp=0#! /bin/sh
case $( sysctl -n hw.acpi.acline ) in
(0) # BATTERY
doas sysctl dev.hwpstate_intel.0.epp=100 1> /dev/null 2> /dev/null
doas sysctl dev.hwpstate_intel.1.epp=100 1> /dev/null 2> /dev/null
doas sysctl dev.hwpstate_intel.2.epp=100 1> /dev/null 2> /dev/null
doas sysctl dev.hwpstate_intel.3.epp=100 1> /dev/null 2> /dev/null
doas sysctl dev.hwpstate_intel.4.epp=100 1> /dev/null 2> /dev/null
doas sysctl dev.hwpstate_intel.5.epp=100 1> /dev/null 2> /dev/null
doas sysctl dev.hwpstate_intel.6.epp=100 1> /dev/null 2> /dev/null
doas sysctl dev.hwpstate_intel.7.epp=100 1> /dev/null 2> /dev/null
;;
(1) # AC
doas sysctl dev.hwpstate_intel.0.epp=0 1> /dev/null 2> /dev/null
doas sysctl dev.hwpstate_intel.1.epp=50 1> /dev/null 2> /dev/null
doas sysctl dev.hwpstate_intel.2.epp=100 1> /dev/null 2> /dev/null
doas sysctl dev.hwpstate_intel.3.epp=100 1> /dev/null 2> /dev/null
doas sysctl dev.hwpstate_intel.4.epp=100 1> /dev/null 2> /dev/null
doas sysctl dev.hwpstate_intel.5.epp=100 1> /dev/null 2> /dev/null
doas sysctl dev.hwpstate_intel.6.epp=100 1> /dev/null 2> /dev/null
doas sysctl dev.hwpstate_intel.7.epp=100 1> /dev/null 2> /dev/null
;;
esac% crontab -l
# INTEL/SPEED/SHIFT
* * * * * ~/scripts/acpi-intel-speed-shift.sh

FreeBSD # ls -lh /rescue | head -5
total 1118446
-r-xr-xr-x 146 root wheel 11M 2020.02.19 21:10 [
-r-xr-xr-x 146 root wheel 11M 2020.02.19 21:10 bectl
-r-xr-xr-x 146 root wheel 11M 2020.02.19 21:10 bsdlabel
-r-xr-xr-x 146 root wheel 11M 2020.02.19 21:10 bunzip2FreeBSD # ls /rescue
[ dd fsck_ffs init mdmfs ping rtsol unlink
bectl devfs fsck_msdosfs ipf mkdir ping6 savecore unlzma
bsdlabel df fsck_ufs iscsictl mknod pkill sed unxz
bunzip2 dhclient fsdb iscsid more poweroff setfacl unzstd
bzcat dhclient-script fsirand kenv mount ps sh vi
bzip2 disklabel gbde kill mount_cd9660 pwd shutdown whoami
camcontrol dmesg geom kldconfig mount_msdosfs rcorder sleep xz
cat dump getfacl kldload mount_nfs rdump spppcontrol xzcat
ccdconfig dumpfs glabel kldstat mount_nullfs realpath stty zcat
chflags dumpon gpart kldunload mount_udf reboot swapon zdb
chgrp echo groups ldconfig mount_unionfs red sync zfs
chio ed gunzip less mt rescue sysctl zpool
chmod ex gzcat link mv restore tail zstd
chown expr gzip ln nc rm tar zstdcat
chroot fastboot halt ls newfs rmdir tcsh zstdmt
clri fasthalt head lzcat newfs_msdos route tee
cp fdisk hostname lzma nextboot routed test
csh fsck id md5 nos-tun rrestore tunefs
date fsck_4.2bsd ifconfig mdconfig pgrep rtquery umountFreeBSD # mkdir -p /jail/nextcloud
FreeBSD # fetch -o - http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.1-RELEASE/base.txz | tar --unlink -xpJf - -C /jail/nextcloud
FreeBSD # cat /etc/jail.conf
nextcloud {
host.hostname = nextcloud.local;
ip4.addr = 10.0.0.100;
path = /jail/nextcloud;
}FreeBSD # service jail onestart nextcloud
Starting jails: nextcloud.FreeBSD # jls
JID IP Address Hostname Path
1 10.0.0.100 nextcloud.local /jail/nextcloudLinux # grep -c '^CONFIG' /boot/config-$( uname -r )
4432
FreeBSD # grep -c -E '^(device|options)' /usr/src/sys/amd64/conf/GENERIC
260
FreeBSD # grep -c -E '^(device|options)' /usr/src/sys/amd64/conf/MINIMAL
75FreeBSD # beadm create safe
FreeBSD # cd /usr/src
FreeBSD # make buildworld kernel
FreeBSD # reboot
FreeBSD # cd /usr/src
FreeBSD # etcupdate -p # // 以前是: mergemaster -p
FreeBSD # make installworld
FreeBSD # etcupdate -B # // 以前是: mergemaster -iU
FreeBSD # rebootFreeBSD # zgrep -c WITHOUT_ /usr/share/man/man5/src.conf.5.gz
294
FreeBSD # zgrep -c WITH_ /usr/share/man/man5/src.conf.5.gz
125FreeBSD # rcorder /etc/rc.d/* | head
/etc/rc.d/growfs
/etc/rc.d/sysctl
/etc/rc.d/hostid
/etc/rc.d/zvol
/etc/rc.d/dumpon
/etc/rc.d/ddb
/etc/rc.d/geli
/etc/rc.d/gbde
/etc/rc.d/ccd
/etc/rc.d/swap
FreeBSD # rcorder /usr/local/etc/rc.d/* | tail
/usr/local/etc/rc.d/hald
/usr/local/etc/rc.d/git_daemon
/usr/local/etc/rc.d/fscd
/usr/local/etc/rc.d/cupsd
/usr/local/etc/rc.d/cups_browsed
/usr/local/etc/rc.d/clamav-clamd
/usr/local/etc/rc.d/clamav-milter
/usr/local/etc/rc.d/clamav-freshclam
/usr/local/etc/rc.d/avahi-dnsconfd
/usr/local/etc/rc.d/aria2
FreeBSD # rcorder /etc/rc.d/* /usr/local/etc/rc.d/* 2> | grep -C 3 sshd
/etc/rc.d/ubthidhci
/etc/rc.d/syscons
/etc/rc.d/swaplate
/etc/rc.d/sshd
/etc/rc.d/cron
/etc/rc.d/jail
/etc/rc.d/localpkg#!/bin/sh
. /etc/rc.subr
name=dummy
rcvar=dummy_enable
start_cmd="${name}_start"
stop_cmd=":"
load_rc_config $name
: ${dummy_enable:=no}
: ${dummy_msg="Nothing started."}
dummy_start()
{
echo "$dummy_msg"
}
run_rc_command "$1"FreeBSD # mount
zroot/ROOT/12.1 on / (zfs, local, noatime, nfsv4acls)
devfs on /dev (devfs, local, multilabel)
zroot/tmp on /tmp (zfs, local, noatime, nosuid, nfsv4acls)
zroot/var/mail on /var/mail (zfs, local, nfsv4acls)
zroot/usr/home on /usr/home (zfs, local, noatime, nfsv4acls)
zroot/var/crash on /var/crash (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot/var/log on /var/log (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot/var/audit on /var/audit (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot/var/tmp on /var/tmp (zfs, local, noatime, nosuid, nfsv4acls)
zroot/usr/src on /usr/src (zfs, local, noatime, nfsv4acls)
zroot/usr/ports on /usr/ports (zfs, local, noatime, nosuid, nfsv4acls)[root@centos8 ~]# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=919388k,nr_inodes=229847,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime,seclabel)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuset)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,memory)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,blkio)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,hugetlb)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,net_cls,net_prio)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpu,cpuacct)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,freezer)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,perf_event)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,rdma)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,pids)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,devices)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/sda1 on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=34,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=17309)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
debugfs on /sys/kernel/debug type debugfs (rw,relatime,seclabel)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel,pagesize=2M)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=187088k,mode=700)
[root@centos8 ~]# mount | awk '{print $5}' | sort -u
autofs
bpf
cgroup
configfs
debugfs
devpts
devtmpfs
hugetlbfs
mqueue
proc
pstore
securityfs
selinuxfs
sysfs
tmpfs
xfs[root@centos7 ~]# mount -t xfs
/dev/sda1 on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota)[root@centos7 ~]# ls -1 /etc/sysconfig/network-scripts/ifcfg-*
ifcfg-Bond_connection_1
ifcfg-eno49
ifcfg-eno49-1
ifcfg-eno50
ifcfg-eno50-1
ifcfg-VLAN_connection_1
[root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-Bond_connection_1
DEVICE=bond0
BONDING_OPTS="miimon=1 updelay=0 downdelay=0 mode=active-backup"
TYPE=Bond
BONDING_MASTER=yes
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_PRIVACY=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME="Bond connection 1"
UUID=ca85417f-8852-43bf-96ee-5bd3f0f83648
ONBOOT=yes
[root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno49
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eno49
UUID=2f60f50b-38ad-492a-b90a-ba736acf6792
DEVICE=eno49
ONBOOT=no
[root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno49-1
HWADDR=xx:xx:xx:xx:xx:xx
TYPE=Ethernet
NAME=eno49
UUID=342b8494-126d-4f3a-b749-694c8c922aa1
DEVICE=eno49
ONBOOT=yes
MASTER=bond0
SLAVE=yes
[root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno50
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eno50
UUID=4fd36e24-1c6d-4a65-a316-7a14e9a92965
DEVICE=eno50
ONBOOT=no
[root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno50-1
HWADDR=xx:xx:xx:xx:xx:xx
TYPE=Ethernet
NAME=eno50
UUID=a429b697-73c2-404d-9379-472cb3c35e06
DEVICE=eno50
ONBOOT=yes
MASTER=bond0
SLAVE=yes
[root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-VLAN_connection_1
VLAN=yes
TYPE=Vlan
PHYSDEV=ca85417f-8852-43bf-96ee-5bd3f0f83648
VLAN_ID=601
REORDER_HDR=yes
GVRP=no
MVRP=no
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
IPADDR=10.20.30.40
PREFIX=24
GATEWAY=10.20.30.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_PRIVACY=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME="VLAN connection 1"
UUID=90f7a9bb-1443-4adf-a3eb-86a03b23ecfb
ONBOOT=yes[root@centos7 ~]# cat /etc/sysconfig/network
GATEWAY=10.20.30.1
NOZEROCONF=yes
[root@centos7 ~]# ls -1 /etc/sysconfig/network-scripts/ifcfg-*
ifcfg-bond0
ifcfg-bond0.601
ifcfg-eno49
ifcfg-eno50
[root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BONDING_OPTS="miimon=1 updelay=0 downdelay=0 mode=active-backup"
TYPE=Bond
BONDING_MASTER=yes
BOOTPROTO=none
IPV4_FAILURE_FATAL=no
IPV6INIT=no
ONBOOT=yes
[root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0.601
VLAN=yes
TYPE=Vlan
VLAN_ID=601
DEVICE=bond0.601
REORDER_HDR=yes
GVRP=no
MVRP=no
BOOTPROTO=none
IPADDR=10.20.30.40
PREFIX=24
IPV4_FAILURE_FATAL=no
IPV6INIT=no
ONBOOT=yes
[root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno49
BOOTPROTO=none
IPV4_FAILURE_FATAL=no
IPV6INIT=no
TYPE=Ethernet
NAME=eno49
DEVICE=eno49
ONBOOT=yes
MASTER=bond0
SLAVE=yes
[root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno50
BOOTPROTO=none
IPV4_FAILURE_FATAL=no
IPV6INIT=no
TYPE=Ethernet
NAME=eno50
DEVICE=eno50
ONBOOT=yes
MASTER=bond0
SLAVE=yesFreeBSD # cat /etc/rc.conf
ifconfig_fxp0="up"
ifconfig_fxp1="up"
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto failover laggport fxp0 laggport fxp1"
vlans_lagg0="601"
ifconfig_lagg0_601="inet 10.20.30.40/24"
defaultrouter="10.20.30.1"















2 x 10 核 Intel Xeon Silver 4114 CPU @ 2.20GHz
4 x 32 GB DDR4 内存(总计 128 GB)
2 x Intel SSD DC S3500 240 GB(系统盘)
90 x Toshiba HDD MN07ACA12TE 12 TB(数据盘)
2 x Broadcom SAS3008 控制器
2 x Intel X710 DA-2 10GE 网卡
2 x 电源# zpool list zroot
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
zroot 220G 3.75G 216G - - 0% 1% 1.00x ONLINE -
# zpool status zroot
pool: zroot
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
zroot ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
da91p4 ONLINE 0 0 0
da11p4 ONLINE 0 0 0
errors: No known data errors
# df -g
Filesystem 1G-blocks Used Avail Capacity Mounted on
zroot/ROOT/default 211 2 209 1% /
devfs 0 0 0 100% /dev
zroot/tmp 209 0 209 0% /tmp
zroot/usr/home 209 0 209 0% /usr/home
zroot/usr/ports 210 0 209 0% /usr/ports
zroot/usr/src 210 0 209 0% /usr/src
zroot/var/audit 209 0 209 0% /var/audit
zroot/var/crash 209 0 209 0% /var/crash
zroot/var/log 209 0 209 0% /var/log
zroot/var/mail 209 0 209 0% /var/mail
zroot/var/tmp 209 0 209 0% /var/tmp
# beadm list
BE Active Mountpoint Space Created
default NR / 2.4G 2019-05-24 13:24DISKS CONTENT
12 raidz2-0
12 raidz2-1
12 raidz2-2
12 raidz2-3
12 raidz2-4
12 raidz2-5
12 raidz2-6
6 spares
90 TOTAL# camcontrol devlist | sort -k 6
(AHCI SGPIO Enclosure 1.00 0001) at scbus2 target 0 lun 0 (pass0,ses0)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 50 lun 0 (pass1,da0)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 52 lun 0 (pass2,da1)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 54 lun 0 (pass3,da2)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 56 lun 0 (pass5,da4)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 57 lun 0 (pass6,da5)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 59 lun 0 (pass7,da6)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 60 lun 0 (pass8,da7)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 66 lun 0 (pass9,da8)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 67 lun 0 (pass10,da9)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 74 lun 0 (pass11,da10)
(ATA INTEL SSDSC2KB24 0100) at scbus3 target 75 lun 0 (pass12,da11)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 76 lun 0 (pass13,da12)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 82 lun 0 (pass14,da13)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 83 lun 0 (pass15,da14)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 85 lun 0 (pass16,da15)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 87 lun 0 (pass17,da16)
(Tyan B7118 0500) at scbus3 target 88 lun 0 (pass18,ses1)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 89 lun 0 (pass19,da17)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 90 lun 0 (pass20,da18)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 91 lun 0 (pass21,da19)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 92 lun 0 (pass22,da20)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 93 lun 0 (pass23,da21)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 94 lun 0 (pass24,da22)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 95 lun 0 (pass25,da23)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 96 lun 0 (pass26,da24)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 97 lun 0 (pass27,da25)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 98 lun 0 (pass28,da26)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 99 lun 0 (pass29,da27)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 100 lun 0 (pass30,da28)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 101 lun 0 (pass31,da29)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 102 lun 0 (pass32,da30)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 103 lun 0 (pass33,da31)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 104 lun 0 (pass34,da32)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 105 lun 0 (pass35,da33)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 106 lun 0 (pass36,da34)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 107 lun 0 (pass37,da35)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 108 lun 0 (pass38,da36)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 109 lun 0 (pass39,da37)
(ATA TOSHIBA MG07ACA1 0101) at scbus3 target 110 lun 0 (pass40,da38)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 48 lun 0 (pass41,da39)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 49 lun 0 (pass42,da40)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 51 lun 0 (pass43,da41)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 53 lun 0 (pass44,da42)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 55 lun 0 (da43,pass45)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 59 lun 0 (pass46,da44)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 64 lun 0 (pass47,da45)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 67 lun 0 (pass48,da46)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 68 lun 0 (pass49,da47)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 69 lun 0 (pass50,da48)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 73 lun 0 (pass51,da49)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 76 lun 0 (pass52,da50)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 77 lun 0 (pass53,da51)
(Tyan B7118 0500) at scbus4 target 80 lun 0 (pass54,ses2)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 81 lun 0 (pass55,da52)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 82 lun 0 (pass56,da53)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 83 lun 0 (pass57,da54)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 84 lun 0 (pass58,da55)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 85 lun 0 (pass59,da56)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 86 lun 0 (pass60,da57)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 87 lun 0 (pass61,da58)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 88 lun 0 (pass62,da59)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 89 lun 0 (da63,pass66)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 90 lun 0 (pass64,da61)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 91 lun 0 (pass65,da62)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 92 lun 0 (da60,pass63)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 94 lun 0 (pass67,da64)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 97 lun 0 (pass68,da65)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 98 lun 0 (pass69,da66)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 99 lun 0 (pass70,da67)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 100 lun 0 (pass71,da68)
(Tyan B7118 0500) at scbus4 target 101 lun 0 (pass72,ses3)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 102 lun 0 (pass73,da69)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 103 lun 0 (pass74,da70)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 104 lun 0 (pass75,da71)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 105 lun 0 (pass76,da72)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 106 lun 0 (pass77,da73)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 107 lun 0 (pass78,da74)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 108 lun 0 (pass79,da75)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 109 lun 0 (pass80,da76)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 110 lun 0 (pass81,da77)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 111 lun 0 (pass82,da78)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 112 lun 0 (pass83,da79)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 113 lun 0 (pass84,da80)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 114 lun 0 (pass85,da81)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 115 lun 0 (pass86,da82)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 116 lun 0 (pass87,da83)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 117 lun 0 (pass88,da84)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 118 lun 0 (pass89,da85)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 119 lun 0 (pass90,da86)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 120 lun 0 (pass91,da87)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 121 lun 0 (pass92,da88)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 122 lun 0 (pass93,da89)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 123 lun 0 (pass94,da90)
(ATA INTEL SSDSC2KB24 0100) at scbus4 target 124 lun 0 (pass95,da91)
(ATA TOSHIBA MG07ACA1 0101) at scbus4 target 125 lun 0 (da3,pass4)# sesutil locate all off
# sesutil locate da64 on# grep da64 /var/run/dmesg.boot
da64 at mpr1 bus 0 scbus4 target 93 lun 0
da64: Fixed Direct Access SPC-4 SCSI device
da64: Serial Number 98G0A1EQF95G
da64: 1200.000MB/s transfers
da64: Command Queueing enabled
da64: 11444224MB (23437770752 512 byte sectors)# expr 23437770752 \* 512
12000138625024# camcontrol devlist \
| grep TOSHIBA \
| awk '{print $NF}' \
| awk -F ',' '{print $2}' \
| tr -d ')' \
| while read DISK
do
gpart destroy -F ${DISK} 1> /dev/null 2> /dev/null
gpart create -s GPT ${DISK}
gpart add -t freebsd-zfs -s 11175G ${DISK}
done
# gpart show da64
=> 40 23437770672 da64 GPT (11T)
40 23435673600 1 freebsd-zfs (11T)
23435673640 2097072 - free - (1.0G)# sysctl vfs.zfs.min_auto_ashift=12
vfs.zfs.min_auto_ashift: 12 -> 12
# zpool create nas02 \
raidz2 da0p1 da1p1 da2p1 da3p1 da4p1 da5p1 da6p1 da7p1 da8p1 da9p1 da10p1 da12p1 \
raidz2 da13p1 da14p1 da15p1 da16p1 da17p1 da18p1 da19p1 da20p1 da21p1 da22p1 da23p1 da24p1 \
raidz2 da25p1 da26p1 da27p1 da28p1 da29p1 da30p1 da31p1 da32p1 da33p1 da34p1 da35p1 da36p1 \
raidz2 da37p1 da38p1 da39p1 da40p1 da41p1 da42p1 da43p1 da44p1 da45p1 da46p1 da47p1 da48p1 \
raidz2 da49p1 da50p1 da51p1 da52p1 da53p1 da54p1 da55p1 da56p1 da57p1 da58p1 da59p1 da60p1 \
raidz2 da61p1 da62p1 da63p1 da64p1 da65p1 da66p1 da67p1 da68p1 da69p1 da70p1 da71p1 da72p1 \
raidz2 da73p1 da74p1 da75p1 da76p1 da77p1 da78p1 da79p1 da80p1 da81p1 da82p1 da83p1 da84p1 \
spare da85p1 da86p1 da87p1 da88p1 da89p1 da90p1
# zpool status
pool: nas02
state: ONLINE
scan: scrub repaired 0 in 0 days 00:00:05 with 0 errors on Fri May 31 10:26:29 2019
config:
NAME STATE READ WRITE CKSUM
nas02 ONLINE 0 0 0
raidz2-0 ONLINE 0 0 0
da0p1 ONLINE 0 0 0
da1p1 ONLINE 0 0 0
da2p1 ONLINE 0 0 0
da3p1 ONLINE 0 0 0
da4p1 ONLINE 0 0 0
da5p1 ONLINE 0 0 0
da6p1 ONLINE 0 0 0
da7p1 ONLINE 0 0 0
da8p1 ONLINE 0 0 0
da9p1 ONLINE 0 0 0
da10p1 ONLINE 0 0 0
da12p1 ONLINE 0 0 0
raidz2-1 ONLINE 0 0 0
da13p1 ONLINE 0 0 0
da14p1 ONLINE 0 0 0
da15p1 ONLINE 0 0 0
da16p1 ONLINE 0 0 0
da17p1 ONLINE 0 0 0
da18p1 ONLINE 0 0 0
da19p1 ONLINE 0 0 0
da20p1 ONLINE 0 0 0
da21p1 ONLINE 0 0 0
da22p1 ONLINE 0 0 0
da23p1 ONLINE 0 0 0
da24p1 ONLINE 0 0 0
raidz2-2 ONLINE 0 0 0
da25p1 ONLINE 0 0 0
da26p1 ONLINE 0 0 0
da27p1 ONLINE 0 0 0
da28p1 ONLINE 0 0 0
da29p1 ONLINE 0 0 0
da30p1 ONLINE 0 0 0
da31p1 ONLINE 0 0 0
da32p1 ONLINE 0 0 0
da33p1 ONLINE 0 0 0
da34p1 ONLINE 0 0 0
da35p1 ONLINE 0 0 0
da36p1 ONLINE 0 0 0
raidz2-3 ONLINE 0 0 0
da37p1 ONLINE 0 0 0
da38p1 ONLINE 0 0 0
da39p1 ONLINE 0 0 0
da40p1 ONLINE 0 0 0
da41p1 ONLINE 0 0 0
da42p1 ONLINE 0 0 0
da43p1 ONLINE 0 0 0
da44p1 ONLINE 0 0 0
da45p1 ONLINE 0 0 0
da46p1 ONLINE 0 0 0
da47p1 ONLINE 0 0 0
da48p1 ONLINE 0 0 0
raidz2-4 ONLINE 0 0 0
da49p1 ONLINE 0 0 0
da50p1 ONLINE 0 0 0
da51p1 ONLINE 0 0 0
da52p1 ONLINE 0 0 0
da53p1 ONLINE 0 0 0
da54p1 ONLINE 0 0 0
da55p1 ONLINE 0 0 0
da56p1 ONLINE 0 0 0
da57p1 ONLINE 0 0 0
da58p1 ONLINE 0 0 0
da59p1 ONLINE 0 0 0
da60p1 ONLINE 0 0 0
raidz2-5 ONLINE 0 0 0
da61p1 ONLINE 0 0 0
da62p1 ONLINE 0 0 0
da63p1 ONLINE 0 0 0
da64p1 ONLINE 0 0 0
da65p1 ONLINE 0 0 0
da66p1 ONLINE 0 0 0
da67p1 ONLINE 0 0 0
da68p1 ONLINE 0 0 0
da69p1 ONLINE 0 0 0
da70p1 ONLINE 0 0 0
da71p1 ONLINE 0 0 0
da72p1 ONLINE 0 0 0
raidz2-6 ONLINE 0 0 0
da73p1 ONLINE 0 0 0
da74p1 ONLINE 0 0 0
da75p1 ONLINE 0 0 0
da76p1 ONLINE 0 0 0
da77p1 ONLINE 0 0 0
da78p1 ONLINE 0 0 0
da79p1 ONLINE 0 0 0
da80p1 ONLINE 0 0 0
da81p1 ONLINE 0 0 0
da82p1 ONLINE 0 0 0
da83p1 ONLINE 0 0 0
da84p1 ONLINE 0 0 0
spares
da85p1 AVAIL
da86p1 AVAIL
da87p1 AVAIL
da88p1 AVAIL
da89p1 AVAIL
da90p1 AVAIL
errors: No known data errors
# zpool list nas02
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
nas02 915T 1.42M 915T - - 0% 0% 1.00x ONLINE -
# zfs list nas02
NAME USED AVAIL REFER MOUNTPOINT
nas02 88K 675T 201K none# zfs set compression=lz4 nas02
# zfs set atime=off nas02
# zfs set mountpoint=none nas02
# zfs set recordsize=1m nas02
# zfs set redundant_metadata=most nas02
# zfs create nas02/nfs
# zfs create nas02/smb
# zfs create nas02/iscsi
# zfs set recordsize=4k nas02/iscsi# man zfs
(...)
redundant_metadata=all | most
Controls what types of metadata are stored redundantly. ZFS stores
an extra copy of metadata, so that if a single block is corrupted,
the amount of user data lost is limited. This extra copy is in
addition to any redundancy provided at the pool level (e.g. by
mirroring or RAID-Z), and is in addition to an extra copy specified
by the copies property (up to a total of 3 copies). For example if
the pool is mirrored, copies=2, and redundant_metadata=most, then ZFS
stores 6 copies of most metadata, and 4 copies of data and some
metadata.
When set to all, ZFS stores an extra copy of all metadata. If a
single on-disk block is corrupt, at worst a single block of user data
(which is recordsize bytes long can be lost.)
When set to most, ZFS stores an extra copy of most types of metadata.
This can improve performance of random writes, because less metadata
must be written. In practice, at worst about 100 blocks (of
recordsize bytes each) of user data can be lost if a single on-disk
block is corrupt. The exact behavior of which metadata blocks are
stored redundantly may change in future releases.
The default value is all.
控制存储哪些类型的元数据为冗余。
ZFS 会存储额外的元数据副本,以便当单个块损坏时,用户数据的丢失量有限。
这个额外副本是在池级别提供的冗余(例如镜像或 RAID-Z)之外的,并且是在 **copies** 属性指定的额外副本之外(最多可达三份)。
例如,如果池是镜像,copies=2,且 redundant_metadata=most,那么 ZFS 会为大部分元数据存储 6 份副本,为数据和部分元数据存储 4 份副本。
当设置为 **all** 时,ZFS 会为所有元数据存储额外副本。
如果单个磁盘块损坏,最坏情况下只会丢失一块用户数据(大小为 recordsize 字节)。
当设置为 **most** 时,ZFS 会为大部分类型的元数据存储额外副本。
这可以提升随机写入性能,因为需要写入的元数据更少。
实际上,如果单个磁盘块损坏,最坏情况下可能丢失大约 100 块用户数据(每块大小为 recordsize 字节)。
具体哪些元数据块会被冗余存储,未来版本可能会有所变化。
默认值为 **all**。
(...)# zfs create -s -V 16T nas02/iscsi/test# zpool get autoreplace nas02
NAME PROPERTY VALUE SOURCE
nas02 autoreplace off default
# zpool set autoreplace=on nas02
# zpool get autoreplace nas02
NAME PROPERTY VALUE SOURCE
nas02 autoreplace on local# grep vfs.zfs /boot/loader.conf
vfs.zfs.prefetch_disable=1
vfs.zfs.cache_flush_disable=1
vfs.zfs.vdev.cache.size=16M
vfs.zfs.arc_min=64G
vfs.zfs.arc_max=96G
vfs.zfs.deadman_enabled=0# head -5 /etc/rc.conf
defaultrouter="10.20.30.254"
ifconfig_ixl0="up"
ifconfig_ixl1="up"
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto lacp laggport ixl0 laggport ixl1 10.20.30.2/24 up"
# ifconfig lagg0
lagg0: flags=8843 metric 0 mtu 1500
options=e507bb
ether a0:42:3f:a0:42:3f
inet 10.20.30.2 netmask 0xffffff00 broadcast 10.20.30.255
laggproto lacp lagghash l2,l3,l4
laggport: ixl0 flags=1c
laggport: ixl1 flags=1c
groups: lagg
media: Ethernet autoselect
status: active
nd6 options=29NEXUS-1 Eth1/32 NAS02_IXL0 connected 3 full a-10G SFP-H10GB-A
NEXUS-2 Eth1/32 NAS02_IXL1 connected 3 full a-10G SFP-H10GB-Ainterface Ethernet1/32
description NAS02_IXL1
switchport
switchport access vlan 3
mtu 9216
channel-group 128 mode active
no shutdown
!
interface port-channel128
description NAS02
switchport
switchport access vlan 3
mtu 9216
vpc 128# cat /etc/rc.conf
# 网络
hostname="nas02.local"
defaultrouter="10.20.30.254"
ifconfig_ixl0="up"
ifconfig_ixl1="up"
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto lacp laggport ixl0 laggport ixl1 10.20.30.2/24 up"
# 内核模块
kld_list="${kld_list} aesni"
# 守护进程 | 启用
zfs_enable=YES
zfsd_enable=YES
sshd_enable=YES
ctld_enable=YES
powerd_enable=YES
# 守护进程 | NFS 服务
nfs_server_enable=YES
nfs_client_enable=YES
rpc_lockd_enable=YES
rpc_statd_enable=YES
rpcbind_enable=YES
mountd_enable=YES
mountd_flags="-r"
# 其他
dumpdev=NO# cat /boot/loader.conf
# 启动参数
autoboot_delay=3
kern.geom.label.disk_ident.enable=0
kern.geom.label.gptid.enable=0
# 禁用英特尔超线程
machdep.hyperthreading_allowed=0
# 在内核加载前更新英特尔处理器微码
cpu_microcode_load=YES
cpu_microcode_name=/boot/firmware/intel-ucode.bin
# 模块
zfs_load=YES
aio_load=YES
# RACCT/RCTL 资源限制
kern.racct.enable=1
# 启动时禁用内存测试
hw.memtest.tests=0
# 管道 KVA 限制 | 320 MB
kern.ipc.maxpipekva=335544320
# IPC
kern.ipc.shmseg=1024
kern.ipc.shmmni=1024
kern.ipc.shmseg=1024
kern.ipc.semmns=512
kern.ipc.semmnu=256
kern.ipc.semume=256
kern.ipc.semopm=256
kern.ipc.semmsl=512
# 大页映射
vm.pmap.pg_ps_enabled=1
# ZFS 调优
vfs.zfs.prefetch_disable=1
vfs.zfs.cache_flush_disable=1
vfs.zfs.vdev.cache.size=16M
vfs.zfs.arc_min=64G
vfs.zfs.arc_max=96G
# ZFS 禁用对过期 I/O 的 panic
vfs.zfs.deadman_enabled=0
# NEWCONS 挂起
kern.vt.suspendswitch=0# cat /etc/sysctl.conf
# ZFS 对齐大小
vfs.zfs.min_auto_ashift=12
# 安全
security.bsd.stack_guard_page=1
# 安全性:Intel MDS(微架构数据采样)缓解措施
hw.mds_disable=3
# 禁用恼人的功能
kern.coredump=0
hw.syscons.bell=0
# IPC
kern.ipc.shmmax=4294967296
kern.ipc.shmall=2097152
kern.ipc.somaxconn=4096
kern.ipc.maxsockbuf=5242880
kern.ipc.shm_allow_removed=1
# 网络
kern.ipc.maxsockbuf=16777216
kern.ipc.soacceptqueue=1024
net.inet.tcp.recvbuf_max=8388608
net.inet.tcp.sendbuf_max=8388608
net.inet.tcp.mssdflt=1460
net.inet.tcp.minmss=1300
net.inet.tcp.syncache.rexmtlimit=0
net.inet.tcp.syncookies=0
net.inet.tcp.tso=0
net.inet.ip.process_options=0
net.inet.ip.random_id=1
net.inet.ip.redirect=0
net.inet.icmp.drop_redirect=1
net.inet.tcp.always_keepalive=0
net.inet.tcp.drop_synfin=1
net.inet.tcp.fast_finwait2_recycle=1
net.inet.tcp.icmp_may_rst=0
net.inet.tcp.msl=8192
net.inet.tcp.path_mtu_discovery=0
net.inet.udp.blackhole=1
net.inet.tcp.blackhole=2
net.inet.tcp.hostcache.expire=7200
net.inet.tcp.delacktime=20# pkg search swift
(...)
py27-swift-2.2.2_1 Highly available, distributed, eventually consistent object/blob store
(...)# iperf3 -sC:\iperf-3.1.3-win64>iperf3.exe -c nas02 -P 8
(...)
[SUM] 0.00-10.00 sec 10.8 GBytes 9.26 Gbits/sec receiver
(..)# diskinfo -ctv /dev/da12
/dev/da12
512 # sectorsize
12000138625024 # mediasize in bytes (11T)
23437770752 # mediasize in sectors
4096 # stripesize
0 # stripeoffset
1458933 # Cylinders according to firmware.
255 # Heads according to firmware.
63 # Sectors according to firmware.
ATA TOSHIBA MG07ACA1 # Disk descr.
98H0A11KF95G # Disk ident.
id1,enc@n500e081010445dbd/type@0/slot@c/elmdesc@ArrayDevice11 # Physical path
No # TRIM/UNMAP support
7200 # Rotation rate in RPM
Not_Zoned # Zone Mode
I/O command overhead:
time to read 10MB block 0.067031 sec = 0.003 msec/sector
time to read 20480 sectors 2.619989 sec = 0.128 msec/sector
calculated command overhead = 0.125 msec/sector
Seek times:
Full stroke: 250 iter in 5.665880 sec = 22.664 msec
Half stroke: 250 iter in 4.263047 sec = 17.052 msec
Quarter stroke: 500 iter in 6.867914 sec = 13.736 msec
Short forward: 400 iter in 3.057913 sec = 7.645 msec
Short backward: 400 iter in 1.979287 sec = 4.948 msec
Seq outer: 2048 iter in 0.169472 sec = 0.083 msec
Seq inner: 2048 iter in 0.469630 sec = 0.229 msec
Transfer rates:
outside: 102400 kbytes in 0.478251 sec = 214114 kbytes/sec
middle: 102400 kbytes in 0.605701 sec = 169060 kbytes/sec
inside: 102400 kbytes in 1.303909 sec = 78533 kbytes/sec# diskinfo -ctv /dev/zvol/nas02/iscsi/test
/dev/zvol/nas02/iscsi/test
512 # sectorsize
17592186044416 # mediasize in bytes (16T)
34359738368 # mediasize in sectors
65536 # stripesize
0 # stripeoffset
Yes # TRIM/UNMAP support
Unknown # Rotation rate in RPM
I/O command overhead:
time to read 10MB block 0.004512 sec = 0.000 msec/sector
time to read 20480 sectors 0.196824 sec = 0.010 msec/sector
calculated command overhead = 0.009 msec/sector
Seek times:
Full stroke: 250 iter in 0.006151 sec = 0.025 msec
Half stroke: 250 iter in 0.008228 sec = 0.033 msec
Quarter stroke: 500 iter in 0.014062 sec = 0.028 msec
Short forward: 400 iter in 0.010564 sec = 0.026 msec
Short backward: 400 iter in 0.011725 sec = 0.029 msec
Seq outer: 2048 iter in 0.028198 sec = 0.014 msec
Seq inner: 2048 iter in 0.028416 sec = 0.014 msec
Transfer rates:
outside: 102400 kbytes in 0.036938 sec = 2772213 kbytes/sec
middle: 102400 kbytes in 0.043076 sec = 2377194 kbytes/sec
inside: 102400 kbytes in 0.034260 sec = 2988908 kbytes/sec# dd if=/dev/zero of=FILE bs=128m status=progress
26172456960 bytes (26 GB, 24 GiB) transferred 16.074s, 1628 MB/s
202+0 records in
201+0 records out
26977763328 bytes transferred in 16.660884 secs (1619227644 bytes/sec)# dd if=/dev/zero of=FILE${X} bs=128m status=progress
80933289984 bytes (81 GB, 75 GiB) transferred 98.081s, 825 MB/s
608+0 records in
608+0 records out
81604378624 bytes transferred in 98.990579 secs (824365101 bytes/sec)# dd if=/dev/zero of=FILE${X} bs=128m status=progress
174214610944 bytes (174 GB, 162 GiB) transferred 385.042s, 452 MB/s
1302+0 records in
1301+0 records out
174617264128 bytes transferred in 385.379296 secs (453104943 bytes/sec)1 STREAM(s) ~ 1600 MB/s ~ 1.5 GB/s
4 STREAM(s) ~ 3300 MB/s ~ 3.2 GB/s
8 STREAM(s) ~ 3600 MB/s ~ 3.5 GB/s# time blogbench -d .
Frequency = 10 secs
Scratch dir = [.]
Spawning 3 writers...
Spawning 1 rewriters...
Spawning 5 commenters...
Spawning 100 readers...
Benchmarking for 30 iterations.
The test will run during 5 minutes.
(...)
Final score for writes: 6476
Final score for reads : 660436
blogbench -d . 280.58s user 4974.41s system 1748% cpu 5:00.54 total# time blogbench -d .
Frequency = 10 secs
Scratch dir = [.]
Spawning 3 writers...
Spawning 1 rewriters...
Spawning 5 commenters...
Spawning 100 readers...
Benchmarking for 30 iterations.
The test will run during 5 minutes.
(...)
Final score for writes: 7087
Final score for reads : 733932
blogbench -d . 299.08s user 5415.04s system 1900% cpu 5:00.68 total# time blogbench -d .
Frequency = 10 secs
Scratch dir = [.]
Spawning 3 writers...
Spawning 1 rewriters...
Spawning 5 commenters...
Spawning 100 readers...
Benchmarking for 30 iterations.
The test will run during 5 minutes.
(...)
Final score for writes: 6109
Final score for reads : 654099
blogbench -d . 278.73s user 5058.75s system 1777% cpu 5:00.30 totalusage: randomio filename nr_threads write_fraction_of_io fsync_fraction_of_writes io_size nr_seconds_between_samples
filename Filename or device to read/write.
write_fraction_of_io What fraction of I/O should be writes - for example 0.25 for 25% write.
fsync_fraction_of_writes What fraction of writes should be fsync'd.
io_size How many bytes to read/write (multiple of 512 bytes).
nr_seconds_between_samples How many seconds to average samples over.# zfs create -s -V 1T nas02/iscsi/test
# randomio /dev/zvol/nas02/iscsi/test 8 0.25 1 4096 10
total | read: latency (ms) | write: latency (ms)
iops | iops min avg max sdev | iops min avg max sdev
--------+-----------------------------------+----------------------------------
54137.7 |40648.4 0.0 0.1 575.8 2.2 |13489.4 0.0 0.3 405.8 2.6
66248.4 |49641.5 0.0 0.1 19.6 0.3 |16606.9 0.0 0.2 26.4 0.7
66411.0 |49817.2 0.0 0.1 19.7 0.3 |16593.8 0.0 0.2 20.3 0.7
64158.9 |48142.8 0.0 0.1 254.7 0.7 |16016.1 0.0 0.2 130.4 1.0
48454.1 |36390.8 0.0 0.1 542.8 2.7 |12063.3 0.0 0.3 507.5 3.2
66796.1 |50067.4 0.0 0.1 24.1 0.3 |16728.7 0.0 0.2 23.4 0.7
58512.2 |43851.7 0.0 0.1 576.5 1.7 |14660.5 0.0 0.2 307.2 1.7
63195.8 |47341.8 0.0 0.1 261.6 0.9 |15854.1 0.0 0.2 361.1 1.9
67086.0 |50335.6 0.0 0.1 20.4 0.3 |16750.4 0.0 0.2 25.1 0.8
67429.8 |50549.6 0.0 0.1 21.8 0.3 |16880.3 0.0 0.2 20.6 0.7
^C# zfs create -s -V 1T nas02/iscsi/test
# randomio /dev/zvol/nas02/iscsi/TEST 8 0.25 1 512 10
total | read: latency (ms) | write: latency (ms)
iops | iops min avg max sdev | iops min avg max sdev
--------+-----------------------------------+----------------------------------
58218.9 |43712.0 0.0 0.1 501.5 2.1 |14506.9 0.0 0.2 272.5 1.6
66325.3 |49703.8 0.0 0.1 352.0 0.9 |16621.4 0.0 0.2 352.0 1.5
68130.5 |51100.8 0.0 0.1 24.6 0.3 |17029.7 0.0 0.2 24.4 0.7
68465.3 |51352.3 0.0 0.1 19.9 0.3 |17112.9 0.0 0.2 23.8 0.7
54903.5 |41249.1 0.0 0.1 399.3 1.9 |13654.4 0.0 0.3 335.8 2.2
61259.8 |45898.7 0.0 0.1 574.6 1.7 |15361.0 0.0 0.2 371.5 1.7
68483.3 |51313.1 0.0 0.1 22.9 0.3 |17170.3 0.0 0.2 26.1 0.7
56713.7 |42524.7 0.0 0.1 373.5 1.8 |14189.1 0.0 0.2 438.5 2.7
68861.4 |51657.0 0.0 0.1 21.0 0.3 |17204.3 0.0 0.2 21.7 0.7
68602.0 |51438.4 0.0 0.1 19.5 0.3 |17163.7 0.0 0.2 23.7 0.7
^C# bonnie++ -d . -u root
Using uid:0, gid:0.
Writing a byte at a time...done
Writing intelligently...done
Rewriting...done
Reading a byte at a time...done
Reading intelligently...done
start 'em...done...done...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...done.
Create files in random order...done.
Stat files in random order...done.
Delete files in random order...done.
Version 1.97 ------Sequential Output------ --Sequential Input- --Random-
Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
nas02.local 261368M 139 99 775132 99 589190 99 383 99 1638929 99 12930 2046
Latency 60266us 7030us 7059us 21553us 3844us 5710us
Version 1.97 ------Sequential Create------ --------Random Create--------
nas02.local -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
16 +++++ +++ +++++ +++ 12680 44 +++++ +++ +++++ +++ 30049 99
Latency 2619us 43us 714ms 2748us 28us 58us# fio --randrepeat=1 --direct=1 --gtod_reduce=1 --name=test --filename=random_read_write.fio --bs=4k --iodepth=64 --size=4G --readwrite=randrw --rwmixread=75
test: (g=0): rw=randrw, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=64
fio-3.13
Starting 1 process
Jobs: 1 (f=1): [m(1)][98.0%][r=38.0MiB/s,w=12.2MiB/s][r=9735,w=3128 IOPS][eta 00m:05s]
test: (groupid=0, jobs=1): err= 0: pid=35368: Tue Jun 18 15:14:44 2019
read: IOPS=3157, BW=12.3MiB/s (12.9MB/s)(3070MiB/248872msec)
bw ( KiB/s): min= 9404, max=57732, per=98.72%, avg=12469.84, stdev=3082.99, samples=497
iops : min= 2351, max=14433, avg=3117.15, stdev=770.74, samples=497
write: IOPS=1055, BW=4222KiB/s (4323kB/s)(1026MiB/248872msec)
bw ( KiB/s): min= 3179, max=18914, per=98.71%, avg=4166.60, stdev=999.23, samples=497
iops : min= 794, max= 4728, avg=1041.25, stdev=249.76, samples=497
cpu : usr=1.11%, sys=88.64%, ctx=677981, majf=0, minf=0
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=785920,262656,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=64
Run status group 0 (all jobs):
READ: bw=12.3MiB/s (12.9MB/s), 12.3MiB/s-12.3MiB/s (12.9MB/s-12.9MB/s), io=3070MiB (3219MB), run=248872-248872msec
WRITE: bw=4222KiB/s (4323kB/s), 4222KiB/s-4222KiB/s (4323kB/s-4323kB/s), io=1026MiB (1076MB), run=248872-248872msecroot@freenas[~]# pkg audit -F
Fetching vuln.xml.bz2: 100% 785 KiB 804.3kB/s 00:01
python27-2.7.15 is vulnerable:
Python -- NULL pointer dereference vulnerability
CVE: CVE-2019-5010
WWW: https://vuxml.FreeBSD.org/freebsd/d74371d2-4fee-11e9-a5cd-1df8a848de3d.html
curl-7.62.0 is vulnerable:
curl -- multiple vulnerabilities
CVE: CVE-2019-3823
CVE: CVE-2019-3822
CVE: CVE-2018-16890
WWW: https://vuxml.FreeBSD.org/freebsd/714b033a-2b09-11e9-8bc3-610fd6e6cd05.html
libgcrypt-1.8.2 is vulnerable:
libgcrypt -- side-channel attack vulnerability
CVE: CVE-2018-0495
WWW: https://vuxml.FreeBSD.org/freebsd/9b5162de-6f39-11e8-818e-e8e0b747a45a.html
python36-3.6.5_1 is vulnerable:
Python -- NULL pointer dereference vulnerability
CVE: CVE-2019-5010
WWW: https://vuxml.FreeBSD.org/freebsd/d74371d2-4fee-11e9-a5cd-1df8a848de3d.html
pango-1.42.0 is vulnerable:
pango -- remote DoS vulnerability
CVE: CVE-2018-15120
WWW: https://vuxml.FreeBSD.org/freebsd/5a757a31-f98e-4bd4-8a85-f1c0f3409769.html
py36-requests-2.18.4 is vulnerable:
www/py-requests -- Information disclosure vulnerability
WWW: https://vuxml.FreeBSD.org/freebsd/50ad9a9a-1e28-11e9-98d7-0050562a4d7b.html
libnghttp2-1.31.0 is vulnerable:
nghttp2 -- Denial of service due to NULL pointer dereference
CVE: CVE-2018-1000168
WWW: https://vuxml.FreeBSD.org/freebsd/1fccb25e-8451-438c-a2b9-6a021e4d7a31.html
gnupg-2.2.6 is vulnerable:
gnupg -- unsanitized output (CVE-2018-12020)
CVE: CVE-2017-7526
CVE: CVE-2018-12020
WWW: https://vuxml.FreeBSD.org/freebsd/7da0417f-6b24-11e8-84cc-002590acae31.html
py36-cryptography-2.1.4 is vulnerable:
py-cryptography -- tag forgery vulnerability
CVE: CVE-2018-10903
WWW: https://vuxml.FreeBSD.org/freebsd/9e2d0dcf-9926-11e8-a92d-0050562a4d7b.html
perl5-5.26.1 is vulnerable:
perl -- multiple vulnerabilities
CVE: CVE-2018-6913
CVE: CVE-2018-6798
CVE: CVE-2018-6797
WWW: https://vuxml.FreeBSD.org/freebsd/41c96ffd-29a6-4dcc-9a88-65f5038fa6eb.html
libssh2-1.8.0,3 is vulnerable:
libssh2 -- multiple issues
CVE: CVE-2019-3862
CVE: CVE-2019-3861
CVE: CVE-2019-3860
CVE: CVE-2019-3858
WWW: https://vuxml.FreeBSD.org/freebsd/6e58e1e9-2636-413e-9f84-4c0e21143628.html
git-lite-2.17.0 is vulnerable:
Git -- Fix memory out-of-bounds and remote code execution vulnerabilities (CVE-2018-11233 and CVE-2018-11235)
CVE: CVE-2018-11235
CVE: CVE-2018-11233
WWW: https://vuxml.FreeBSD.org/freebsd/c7a135f4-66a4-11e8-9e63-3085a9a47796.html
gnutls-3.5.18 is vulnerable:
GnuTLS -- double free, invalid pointer access
CVE: CVE-2019-3836
CVE: CVE-2019-3829
WWW: https://vuxml.FreeBSD.org/freebsd/fb30db8f-62af-11e9-b0de-001cc0382b2f.html
13 problem(s) in the installed packages found.
root@freenas[~]# uname -a
FreeBSD freenas.local 11.2-STABLE FreeBSD 11.2-STABLE #0 r325575+95cc58ca2a0(HEAD): Mon May 6 19:08:58 EDT 2019 [email protected]:/freenas-releng/freenas/_BE/objs/freenas-releng/freenas/_BE/os/sys/FreeNAS.amd64 amd64
root@freenas[~]# freebsd-version -uk
11.2-STABLE
11.2-STABLE
root@freenas[~]# sockstat -l4
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
root uwsgi-3.6 4006 3 tcp4 127.0.0.1:9042 *:*
root uwsgi-3.6 3188 3 tcp4 127.0.0.1:9042 *:*
nobody mdnsd 3144 4 udp4 *:31417 *:*
nobody mdnsd 3144 6 udp4 *:5353 *:*
www nginx 3132 6 tcp4 *:443 *:*
www nginx 3132 8 tcp4 *:80 *:*
root nginx 3131 6 tcp4 *:443 *:*
root nginx 3131 8 tcp4 *:80 *:*
root ntpd 2823 21 udp4 *:123 *:*
root ntpd 2823 22 udp4 10.49.13.99:123 *:*
root ntpd 2823 25 udp4 127.0.0.1:123 *:*
root sshd 2743 5 tcp4 *:22 *:*
root syslog-ng 2341 19 udp4 *:1031 *:*
nobody mdnsd 2134 3 udp4 *:39020 *:*
nobody mdnsd 2134 5 udp4 *:5353 *:*
root python3.6 236 22 tcp4 *:6000 *:*# zpool import
pool: nas02_gr06
id: 1275660523517109367
state: ONLINE
status: The pool was last accessed by another system.
action: The pool can be imported using its name or numeric identifier and
the '-f' flag.
see: http://illumos.org/msg/ZFS-8000-EY
config:
nas02_gr06 ONLINE
raidz2-0 ONLINE
da58p2 ONLINE
da59p2 ONLINE
da60p2 ONLINE
da61p2 ONLINE
da62p2 ONLINE
da63p2 ONLINE
da64p2 ONLINE
da26p2 ONLINE
da65p2 ONLINE
da23p2 ONLINE
da29p2 ONLINE
da66p2 ONLINE
da67p2 ONLINE
da68p2 ONLINE
spares
da69p2
pool: nas02_gr05
id: 5642709896812665361
state: ONLINE
status: The pool was last accessed by another system.
action: The pool can be imported using its name or numeric identifier and
the '-f' flag.
see: http://illumos.org/msg/ZFS-8000-EY
config:
nas02_gr05 ONLINE
raidz2-0 ONLINE
da20p2 ONLINE
da30p2 ONLINE
da34p2 ONLINE
da50p2 ONLINE
da28p2 ONLINE
da38p2 ONLINE
da51p2 ONLINE
da52p2 ONLINE
da27p2 ONLINE
da32p2 ONLINE
da53p2 ONLINE
da54p2 ONLINE
da55p2 ONLINE
da56p2 ONLINE
spares
da57p2
pool: nas02_gr04
id: 2460983830075205166
state: ONLINE
status: The pool was last accessed by another system.
action: The pool can be imported using its name or numeric identifier and
the '-f' flag.
see: http://illumos.org/msg/ZFS-8000-EY
config:
nas02_gr04 ONLINE
raidz2-0 ONLINE
da44p2 ONLINE
da37p2 ONLINE
da18p2 ONLINE
da36p2 ONLINE
da45p2 ONLINE
da19p2 ONLINE
da22p2 ONLINE
da33p2 ONLINE
da35p2 ONLINE
da21p2 ONLINE
da31p2 ONLINE
da47p2 ONLINE
da48p2 ONLINE
da49p2 ONLINE
spares
da46p2
pool: nas02_gr03
id: 4878868173820164207
state: ONLINE
status: The pool was last accessed by another system.
action: The pool can be imported using its name or numeric identifier and
the '-f' flag.
see: http://illumos.org/msg/ZFS-8000-EY
config:
nas02_gr03 ONLINE
raidz2-0 ONLINE
da81p2 ONLINE
da71p2 ONLINE
da14p2 ONLINE
da15p2 ONLINE
da80p2 ONLINE
da16p2 ONLINE
da88p2 ONLINE
da17p2 ONLINE
da40p2 ONLINE
da41p2 ONLINE
da25p2 ONLINE
da42p2 ONLINE
da24p2 ONLINE
da43p2 ONLINE
spares
da39p2
pool: nas02_gr02
id: 3299037437134217744
state: ONLINE
status: The pool was last accessed by another system.
action: The pool can be imported using its name or numeric identifier and
the '-f' flag.
see: http://illumos.org/msg/ZFS-8000-EY
config:
nas02_gr02 ONLINE
raidz2-0 ONLINE
da84p2 ONLINE
da76p2 ONLINE
da85p2 ONLINE
da8p2 ONLINE
da9p2 ONLINE
da78p2 ONLINE
da73p2 ONLINE
da74p2 ONLINE
da70p2 ONLINE
da77p2 ONLINE
da11p2 ONLINE
da13p2 ONLINE
da79p2 ONLINE
da89p2 ONLINE
spares
da90p2
pool: nas02_gr01
id: 1132383125952900182
state: ONLINE
status: The pool was last accessed by another system.
action: The pool can be imported using its name or numeric identifier and
the '-f' flag.
see: http://illumos.org/msg/ZFS-8000-EY
config:
nas02_gr01 ONLINE
raidz2-0 ONLINE
da91p2 ONLINE
da75p2 ONLINE
da0p2 ONLINE
da82p2 ONLINE
da1p2 ONLINE
da83p2 ONLINE
da2p2 ONLINE
da3p2 ONLINE
da4p2 ONLINE
da5p2 ONLINE
da86p2 ONLINE
da6p2 ONLINE
da7p2 ONLINE
da72p2 ONLINE
spares
da87p2























