Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jan 2017 21:40:16 +0100
From:      Jeremie Le Hen <jlh@freebsd.org>
To:        Steven Hartland <killing@multiplay.co.uk>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: Can't boot on ZFS -- /boot/zfsloader not found
Message-ID:  <CAGSa5y13kCtmA1ZaHFvjX6iPXtHE1mKUk0eeXrU-xL-5V8X0LQ@mail.gmail.com>
In-Reply-To: <d889e3db-8424-ad8f-adea-3946086e1104@multiplay.co.uk>
References:  <CAGSa5y12dKYF-sG5at7zeqttYnZHuSHcC0Zpn7rsekgeFCaRUg@mail.gmail.com> <e885ba54-397c-70f3-0748-0c0fcab8715c@multiplay.co.uk> <CAGSa5y0v2BhdbQ-WmbeZSXPKNzN6RUO8QynL2AiXP5ODWDCFQg@mail.gmail.com> <d889e3db-8424-ad8f-adea-3946086e1104@multiplay.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 12, 2017 at 10:55 PM, Steven Hartland
<killing@multiplay.co.uk> wrote:
> On 12/01/2017 21:12, Jeremie Le Hen wrote:
>
> Hey Steven,
>
> (Please cc: me on reply)
>
> On Thu, Jan 12, 2017 at 1:32 AM, Steven Hartlan
>
> The reason I'd recommend 512k for boot is to provide room for expansion
> moving forward, as repartitioning to upgrade is a scary / hard thing to do.
> Remember it wasn't long ago when it was well under 64k and that's what was
> recommend, its not like with disk sizes these days you'll miss the extra
> 384k ;-)
>
> Yeah, that's wise you're right.
>
> Boot to a live cd, I'd recommend mfsbsd, and make sure the boot loader was
> written to ALL boot disks correctly e.g.
> if you have a mirrored pool with ada0 and ada1:
> gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
> gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
>
> If this doesn't help the output from gpart show, uname -a and zpool status
> would also be helpful.
>
> This is all assuming standard BIOS mode and not UEFI which is done
> differently.
>
> I just use the installation media on an USB key and then drop to the
> shell.  This is a full FreeBSD running, so that's fine.
>
> % # gpart show ada0
> % =>       40  312581728  ada0  GPT  (149G)
> %         40       1024     1  freebsd-boot  (512K)
> %       1064    8387840     2  freebsd-swap  (4.0G)
> %    8388904  304192864     3  freebsd-zfs  (145G)
> %
> % # uname -a
> % FreeBSD  11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 r306420: Thu Sep
> 29 01:43:23 UTC 2016     % %
> root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
> %
> % # zpool status
> %  pool: zroot
> % state: ONLINE
> %  scan: none requested
> % config:
> %
> %        NAME                                          STATE     READ
> WRITE CKSUM
> %        zroot                                         ONLINE       0
>    0     0
> %          gptid/1c387d3b-d892-11e6-944b-f44d30620eeb  ONLINE       0
>    0     0
> %
> % errors: No known data errors
>
> Here are the steps to write the bootloader:
>
> % # gpart bootcode -b /boot/pmbr -p  /boot/gptzfsboot -i 1 ada0
> % partcode written to ada0p1
> % bootcode written to ada0
> % # zpool get bootfs zroot
> % NAME   PROPERTY  VALUE   SOURCE
> % zroot  bootfs    zroot   local
>
> Two things spring to mind
>
> Idea 1:
> Is your root fs actually your direct pool or is it actually /root off your
> pool.
> If so you want to run:
> zpool set bootfs=zroot/root zroot

That was it. My boot volume is "zroot/root" and I was just following
brainlessly the doc which said to use "zroot". This didn't shock me
because this at least points to the right pool

>
> Idea 2:
> You mentioned in your original post and you used zfs send / recv to restore
> the pool, so I wonder if your cache file is out of date.
>
> Try the following:
> zpool export zroot
> zpool import -R /mnt -o cachefile=/boot/zfs/zpool.cache zroot
> cp /boot/zfs/zpool.cache /mnt/boot/zfs/zpool.cache
> zpool set bootfs=zroot/root zroot

I think that was wrong too, but this would probably have caused
problems later in the boot I think.

Anyway, thanks a lot for your help.  I'll give a quick lifting to the wiki page.

-jlh

>
>     Regards
>     Steve



-- 
Jeremie Le Hen
jlh@FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGSa5y13kCtmA1ZaHFvjX6iPXtHE1mKUk0eeXrU-xL-5V8X0LQ>