From Segfault
Jump to navigation Jump to search

ZFS: I/o error - all block copies unavailable

After upgrading to FreeBSD 13 the following happened upon boot:

Booting from Hard Disk...
Keyboard: yes
/boot/config: -P

FreeBSD/x86 boot

Default: zroot/ROOT/default:/boot/zfsloader
boot: ZFS: unsupported compression algorithm 16
ZFS: ifo error - all block copies unavailable
Invalid format

FreeBSD/x86 boot
Default: zroot/ROOT/default:/boot/zfs loader

In this case the fix[1] was to boot into e.g. FreeBSD-13.1-RELEASE-amd64-memstick.img.xz and install the bootcode again:

$ zpool import
  pool: zroot
    id: 17982517483651182104
 state: ONLINE
action: The pool can be imported using its name or numeric identifier.
       zroot       ONLINE
         vtbd0p3   ONLINE

$ gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 vtbd0
partcode written to vtbd0p1
bootcode written to vtbd0

For future upgrades one could use bectl to help with that:[2]

bectl create 13.0-RELEASE
bectl mount 13.0-RELEASE /mnt
zfs set mountpoint=/mnt/usr/src zroot/usr/src
mount -t devfs devfs /mnt/dev
chroot /mnt /bin/sh

freebsd-update upgrade -r 13.0-RELEASE
freebsd-update fetch
freebsd-update install
umount /mnt/dev

zfs set mountpoint=/usr/src zroot/usr/src
bectl umount 13.0-RELEASE
bectl activate 13.0-RELEASE
shutdown -r now

pkg-static install -f pkg
pkg upgrade
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 vtbd0
zpool upgrade -a
shutdown -r now

freebsd-update install
bectl destroy -o 12.2-RELEASE