Zfs: cannot import : I/O error Destroy and re-create the pool from a backup source

After a windows 11 crash, my VMWare Workstation VM running NixOS 23.05 fails to reboot. This also happened a few other times when my laptop ran out of battery.

It fails to boot at Stage 1 with the following ZFS error:

cannot import ‘rpool’ : I/O error
Destroy and re-create the pool from a backup source.

My usual strategy so far has been to just recreate my VM, re-install NixOS and restore my backed-up data into it. Very time consuming.

I am wondering if there is a better solution. For example, to “Destroy and re-create the pool from a backup source.” as indicated.

How can I achieve this from a system that I cannot even boot?

The article zfs: cannot import : I/O error Destroy and re-create the pool from a backup source - Systems Administration Problem Solvers gives some clues but where am I suppose to type the commands mentioned?

Any help would/feedback would be very much appreciated!

Boot the installation media, and then destroy and recreate the pool from backups. This will not be less time consuming than re-installing with a backup of your configuration and then restoring your data from the backup, unless you really have used zfs send to store some datasets on another pool as backup…

I have used the NixOS module services.zfs.autoReplication to perform the replication to a TrueNAS server. The NixOS module uses zfs-replicate but I do not know if that uses zfs send ultimately.

Would that work?

Anything that you can use to stream directly to your pool or dataset should suffice.

I am not aware how well support for one tool or the other is on the installer. I know though, that you can use regular zfs send/zfs receive there. I never used those tools to transfer back into a pool again, just for experiments years ago. creating a file that was a dump of my dataset. as I wanted to experiment with mounting those which wasn’t possible.

I haven’t used ZFS in a while.

So whether or not some certain tool works or not, you have to check.