FreeBSDアップデート後にはZFS zpoolとブートローダーのアップデートを

割と忘れるのでメモ。

freebsd-updatebuildworld 等でFreeBSDのバージョンを上げたら、ZFSのバージョンも上がっていることがある。メジャーバージョンが上がるとZFSのバージョンも上がっていることが多いが、必ずしも上がるわけではない。

いつもFreeBSDのバージョンを上げただけで満足してしまうので、ZFS (zpool) のバージョンの確認も忘れないように。

$ zpool status -v
  pool: zroot1
 state: ONLINE
status: Some supported 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.
  scan: resilvered 8.32M in 0h0m with 0 errors on Wed May 10 10:10:15 2017
config:

        NAME                               STATE     READ WRITE CKSUM
        zroot1                             ONLINE       0     0     0
          mirror-0                         ONLINE       0     0     0
            diskid/DISK-WD-WMC4M3026594p3  ONLINE       0     0     0
            diskid/DISK-WD-WMC4M3152869p3  ONLINE       0     0     0
        cache
          gpt/l2arc0                       ONLINE       0     0     0

errors: No known data errors

zpool upgrade すると全ての機能が使えるようになるといわれるので、OS側のZFSの対応バージョンが上がっている。 あまり調子に乗って上げていると、トラブルが発生してOSのバージョンを下げる必要があるときに困ったことになる。

ファイルシステムのバージョンは基本的に下げられないと思っていたほうがいいので、OSの新しいバージョンが十分に安定稼働していることを確認してから上げたほうがよさそう。

ZFS (zpool) のバージョンを上げるには、言われたとおりのコマンドを実行する。

This system supports ZFS pool feature flags.

Enabled the following features on 'zroot1':
  device_removal
  obsolete_counts
  zpool_checkpoint

If you boot from pool 'zroot1', don't forget to update boot code.
Assuming you use GPT partitioning and da0 is your boot disk
the following command will do it:

        gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0

最後に、ブートローダーも新しいZFS対応のものに上げないと起動できなくなるのでこれはきっちりやっておく。da0は適宜読み替える。

以上、手順自体は今更メモしておくほどのことではないけど、ZFSのバージョンを上げるのを数年忘れていたので思い出しついでにメモ。