Re: ZFS: cannot import zroot: I/O error

From: Toomas Soome <tsoome_at_me.com>
Date: Mon, 15 Aug 2022 16:22:30 UTC

> On 15. Aug 2022, at 18:01, FreeBSD User <freebsd@walstatt-de.de> wrote:
> 
> Hello,
> 
> I'm running a FreeBSD 13.1-RELENG-p1 zroot-based guest in a VirtualBox 4.1.24/26 (do not know
> exactly). The host is a special system based on Linux und VirtualBox and I have no chances to
> configure the VBox.
> 
> Somehow the VBox crashed and hung up the complete computer, so I had to cold start it after
> approx. 30 minutes of waiting. After that, rhe virtual drive and its ZFS filesystem was
> wrecked, shwing a stream of 
> 
> zio_read error: 5
> ZFS: i/o error - all block copies unavailable
> 
> After a quick search I found some advices howto try fixing, last an longest one was 
> 
> zpool import -fFX -N -R /alternate/path zroot
> 
> which took approx 20 minutes - with no success.
> 
> There are some valuable data on the partition, which are all backed up, but it would take its
> time to restore everything, so I'd like to ask whether there is any cance to "repair" the
> mysterious damage.
> 
> I'm able to boot off from an USB flash drive …
> 

This happens when vbox is telling zfs that data is written on disk, but is actually still in caches… So yea, the standard answer could be “restore from backup”, but it also may help to use ability to revert TXG (it does drop data!).  See also https://gist.github.com/mkhon/34d979c78077a20648456272d7f2cc15 <https://gist.github.com/mkhon/34d979c78077a20648456272d7f2cc15>

rgds,
toomas