Re: Busted FreeBSD VM ZFS can't find boot block

From: David Christensen <dpchrist_at_holgerdanske.com>
Date: Sun, 31 Oct 2021 20:52:10 UTC
On 10/31/21 7:45 AM, Kurt Buff wrote:
> All,
> 
> I'm running a FreeBSD 12.2 VM in VMware Workstation Pro under Windows.
> 
> My Windows machine froze, and I couldn't recover except with a hard power
> off.
> 
> The FreeBSD VM is now complaining, emitting the following lines:
> 
>     ZFS: i/o error - all block copies unavailable
>     ZFS: can't read MOS object directory
>     ZFS: can't find root filesystem
>     gptzfsboot: failed to mount default pool zroot
> 
>     FreeBSD/x86 boot
>     ZFS: i/o error - all block copies unavailable
>     ZFS: can't find dataset u
>     Default: zroot/<0x0>:
>     boot:
> 
> I've done a fair amount of STFW, but I'm not seeing how to recover from
> this - most of the entries I've found are about performing upgrades of
> various sorts..
> 
> Can anyone point me to a doco that can help me recover?
> 
> I have booted the VM from the bootonly livecd option, but am at a loss as
> to how to proceed.


On 10/31/21 11:12 AM, Graham Perrin wrote:
 > First: are you certain that the underlying storage and file system are
 > still OK, at the Windows level?


On 10/31/21 11:25 AM, Kurt Buff wrote:
 > AFAICT, yes. Windows itself boots just fine, and I'm running all of my
 > normal Windows applications without problem.
 >
 > chkdsk reveals no problems.


Which version of Windows?


Take a snapshot/ clone/ export of the broken VM.


Can you restore a previous snapshot of the VM and restore settings/ data?


Can you throw away the VM, create another, and restore settings/ data?


Recovering data from inside the VM and/or fixing the VM is going to 
involve mounting the filesystems and/or attempting to boot.  One option 
is to boot the FreeBSD installer and choose "Shell" or "Live CD". 
Another option is to build another VM, install FreeBSD, and use that to 
access the broken VM's disks.


As you mention ZFS, beware of importing two pools with the same name; 
such as the ZFS installer defaults "bootpool" and "zroot".  You may wish 
to specify the "altroot" property when importing the second and 
subsequent pools.


I own a stack of MWL books.  I suggest that you buy these:

https://mwl.io/nonfiction/os#af3e

https://mwl.io/nonfiction/os#fmzfs

https://mwl.io/nonfiction/os#fmaz


David