FreeBSD 10 won't boot to ZFS root after power failure

Solution 1:

Ok, never mind what I said in my other answer. You won't be able to boot into single-user mode if you are having problems with ZFS partitions anyway. What's funny is after I posted my answer, I had a problem with power again and I couldn't boot into my system, just like your problem.

So here is what I did to get back in.

I used a FreeBSD 10.0-RELEASE Live CD (it was a bootonly I think -- to minimize download)

  1. Boot into the CD and choose "Live CD" from the options. (log in as root)
  2. Execute the following commands to attach partitions using geli; you would have to enter your passphrase if you have a root-on-ZFS full disk encryption setup

     mkdir /tmp/bootpool
     zpool import -f bootpool
     zfs set mountpoint=/tmp/bootpool bootpool
     zfs mount -a
     cp /tmp/bootpool/boot/encryption.key /tmp/
     zfs umount -a
     zfs set mountpoint=/bootpool bootpool
     zpool export bootpool
     geli attach -k /tmp/encryption.key /dev/ada0p4
     zpool import -f -R /mnt zroot
    

I had to zpool import with -f flag because the power down problem didn't export the partition in the right way.

After executing these commands I rebooted and the system went online again.

Though, I had another problem with bootpool not loading correctly after boot.

The /boot folder was empty, it was also a symbolic link to the /bootpool/boot directory. I also found out that when importing the zfs bootpool partition it created /bootpool/boot/boot so the issue was the 2 boot folders under /bootpool.

So I did this after reboot to load the bootpool manually.

      zpool export bootpool
      zpool import -f bootpool
      (cd to root and remove the old symbolic link `boot`)
      cd /
      rm boot
      (notice the double `boot` directory issue)
      ln -sf bootpool/boot/boot/

That's it and the /boot symbolic link worked again and I could load the missing kernel modules, for example kldload linux or anything else.

Hope that helps, and if anybody knows a clean fix for the bootpool problem above please share it with me.

Thanks,

Draco

References:

  • http://lists.freebsd.org/pipermail/freebsd-stable/2014-February/077201.html
  • https://forums.freebsd.org/viewtopic.php?&t=42980

Solution 2:

Have you tried booting into single-user mode and force mount ZFS partitions?

# zfs mount -a

I've experienced a power failure on my FreeBSD 10 (which is also Root-on-ZFS) and I managed to get it to boot using the command above.

Let me know how it goes.