ZFS boot problems revisited

Peter Maloney peter.maloney at brockmann-consult.de
Fri Feb 3 13:46:37 UTC 2012


The causes of some zfs boot failures are unknown. I don't know why it
does it. I updated 2 nearly identical systems to 8-STABLE from
8.2-RELEASE and (if I remember correctly) got the same error as you on
one but not the other.

I have only tried 2 way mirrors so far, so I might not know much about
this specific issue, but what comes to mind is what I would call the
'standard zfs boot fix', which I first found here:
http://freebsd.1045724.n5.nabble.com/Difficulties-to-use-ZFS-root-ROOT-MOUNT-ERROR-td4771828.html

It basically goes like this:

Boot off of something with zfs support (eg. a DVD).
Then run these commands (assuming here your root is named "zroot").

zpool import -o altroot=/z -o cachefile=/tmp/zpool.cache zroot
zfs set mountpoint=/ zroot
cp /tmp/zpool.cache /z/boot/zfs/zpool.cache
shutdown -r now

The "mountpoint=/" part is required. And then optionally, you would set
it back to "legacy" before the reboot if that is the way you do things.
I do not prefer "mountpoint=legacy", which most people seem to have and
seems to be in all the howtos, because then if something goes wrong,
altroot will work without unmounting /usr, /var, etc. first and
remounting it all after / is mounted. (which affects things like chroot,
but not simply editing conf if it is in the same dataset).

And do not export the pool, or forget/skip the cache file part, or you
get the same error that you started with. And if you messed up your
config somehow (maybe with mergemaster), you should edit it before the
reboot... better double check.

/etc/rc.conf:
===========
zfs_enable="YES"

/boot/loader.conf
===========
zfs_load="YES"
vfs.root.mountfrom="zfs:zroot"

#depending on your install and hardware, maybe you want to load mps
(8.2-RELEASE). With 8-STABLE you probably don't need this. I wouldn't
just assume the new GENERIC kernel of one version loads the same drivers
as your old GENERIC kernel.
mps_load="YES"






On 02/03/2012 03:16 AM, Peter Jeremy wrote:
> I recently ran into the dreaded "all blocks unavailable" error whilst
> upgrading to a recent 8-stable with a 3-way mirrored ZFS root.
> Installing the latest gptzfsboot helped a bit but still reported
> errors and the boot failed.  I was under the impression that the
> latest boot code had resolved all the problems but it seems there are
> still some cases it can't cope with.  Comparing the code I built with
> the latest head shows no relevant differences (disabling SSE3 & FP and
> changing a constant used for RAIDZ parity calculations).
>
> Are there any known cases that the boot code still doesn't handle?
>
> The failures led me to investigate zfsboottest & zfsboottest.sh.
> Unfortunately, these tools still have some problems: 
> 1) zfsboottest is still built as native dynamic executable.  I'm not
>    sure if being dynamic presents a problem (I would hope it didn't)
>    but it should be an i386 executable on amd64.  The attached patch
>    changes it to be a static i386 executable.
> 2) vfs.root.mountfrom is documented (in sys/kern/vfs_mountroot.c in
>    9.x and later or sys/kern/vfs_mount.c in 8.x and earlier) to take a
>    space-separated list of <vfsname>:[<path>].  zfsboottest.sh expects
>    it to be a bare zpool name.  The attached patch adds the "zfs:"
>    prefix but still limits it to a single item.
> 3) The "you may not be able to boot" message will never appear because
>    it's testing the result of the preceeding "rm -f", rather than the
>    diff (as wanted).  The attached patch fixes this.
>
> I'm still not confident that the flags used to build zfsboottest are
> equivalent to those used to build gptzfsboot but will leave that for
> later investigation.
>
> The attached patches are relative to 8-stable CVS but there are no
> differences to head.
>


-- 

--------------------------------------------
Peter Maloney
Brockmann Consult
Max-Planck-Str. 2
21502 Geesthacht
Germany
Tel: +49 4152 889 300
Fax: +49 4152 889 333
E-mail: peter.maloney at brockmann-consult.de
Internet: http://www.brockmann-consult.de
--------------------------------------------



More information about the freebsd-fs mailing list