25.5 ZFS 的 zpool 升级
升级 zpool
FreeBSD 大版本间通常 zfs 版本都会变动,如从 13.2 到 14.0 的 zpool 版本就有所升级。
此处假定已经用 freebsd-update 从 13.2 升级到了 14.0。
开始前的提醒:准备好 livecd 以应对意外,livecd 要 14.0 及以上的,13.2 不支持(无法访问新版 zfs 文件系统)14.0 的 zfs。
查看 zpool 状态:
# zpool status
pool: zroot
state: ONLINE
status: Some supported and requested features are not enabled on the pool.
The pool can still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(7) for details.
config:
NAME STATE READ WRITE CKSUM
zroot ONLINE 0 0 0
ada0p3 ONLINE 0 0 0
errors: No known data errors未升级前不能使用所有 zfs 新功能,下面进行升级:
# zpool upgrade zroot
This system supports ZFS pool feature flags.
Enabled the following features on 'zroot':
edonr
zilsaxattr
head_errlog
blake3
block_cloning
vdev_zaps_v2
Pool 'zroot' has the bootfs property set, you might need to update
the boot code. See gptzfsboot(8) and loader.efi(8) for details.重写引导(仅非 EFI 引导需要)
警告
bootfs属性是在 zfs 上引导 FreeBSD 的重要标志,不理睬这个提示可能没事,但出了问题就不能引导系统,建议按提示重写boot code(为什么这么建议?因为我炸了)。如果你没有 freebsd-boot 分区就 不需要 以下操作。
查看分区信息:
# gpart show
=> 40 33554352 ada0 GPT (16G)
40 1024 1 freebsd-boot (512K)
1064 984 - free - (492K)
2048 4194304 2 freebsd-swap (2.0G)
4196352 29356032 3 freebsd-zfs (14G)
33552384 2008 - free - (1.0M)找到 freebsd-boot 类型分区,这里序号为 1,对应下面命令中 -i 选项,接着重写 bootcode:
# gpart bootcode -p /boot/gptzfsboot -i 1 ada0
partcode written to ada0p1可再次查看 zpool 状态:
# zpool status
pool: zroot
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
zroot ONLINE 0 0 0
ada0p3 ONLINE 0 0 0
errors: No known data errors最后更新于
这有帮助吗?