Solved Clean a zfs file system using live CD

Due to an unclean shutdown of a FreeBSD guest in VirtualBox, upon rebooting, FreeBSD says:

zio_read error: 5
ZFS: i/o error all block copies unavailable
ZFS: can't read MOS of pool zroot

Can't find /boot/zfsloader
Can't find /boot/loader
Can't find /boot/kernel/kernel

Then it hangs displaying

boot:

Based on what I understood by reading forums, I need to do a zpool scrub zroot
So, using the FreeBSD-13.0 iso, I entered the single user mode.
zfs mount -a
zfs list says no datasets available

gpart show ada0
shows ada0p3 is freebsd-zfs

My question is how do I mount zroot or /dev/ada0p3 so that I can use zpool scrub zroot?
Or is there another way to clean it so that I can boot into FreeBSD?
 
Solution that worked for me:
I did a

zpool import -o readonly=on zroot

That displayed a message saying recovery is possible and I would loose some data.
It asked me to do

zpool import -F zroot

When I tried that it said it is in readonly mode. I rebooted the vm but zroot was still in readonly mode.
So, I did a

zpool export zroot

Then,

zpool status zroot

showed no errors. I am not sure why I didn't have to do zpool import -F zroot to fix the errors. But, I am not complaining. I removed the iso and I can boot into FreeBSD.

So, I guess a simpler solution would have been to just get into the single user mode and type:

zpool import -F zroot
 
Back
Top