Boot an Existing ZFS From a FreeBSD LiveCD

Because I ran gpart bootcode on the wrong partition of every replacement disk I swapped and because my motherboard is incapable of finding an EFI partition, I basically bricked my FreeBSD NAS / gateway.

It took me a ridiculous amount of time in order to find how to boot into an existing ZFS FreeBSD installation from a FreeBSD LiveCD (I used mini-memstick).

Finally, in a 2014 thread from the FreeBSD questions mailing list, someone mentioned the magic invocation, and from there I deducted the remaining parts.

When you’re presented the FreeBSD loader, press 3 in order to get the console, then do the following:

> load /boot/kernel/kernel
> load /boot/kernel/zfs.ko

To load the ZFS kernel module.

Then specify the root device (don’t forget the trailing colon):

> set currdev="zfs:zroot/ROOT/default:"

And finally > boot, will boot using the LiveCD kernel (I was unable to load the kernel from the ZFS filesystem) and will proceed with booting the original operating system, where you will be able to fix your shit with a comfortable environment. Because yes, you could probably fix whatever is needed from the LiveCD but it’s honestly less convenient than your fully customized shell.