Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 05 Jun 2014 07:22:29 -0500
From:      Karl Denninger <karl@denninger.net>
To:        freebsd-stable@freebsd.org
Subject:   Re: ZFS boot pool selection
Message-ID:  <53906105.2080302@denninger.net>
In-Reply-To: <53902B1D.8030200@ish.com.au>
References:  <53902B1D.8030200@ish.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a cryptographically signed message in MIME format.

--------------ms020307060207000604080807
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable


On 6/5/2014 3:32 AM, Aristedes Maniatis wrote:
> I'd like to better understand the boot process as it applies to a ZFS o=
n root approach in FreeBSD 9 or 10 using GPT. What I understand so far:
>
> A. BIOS is able to execute some code placed in a special partition on a=
 GPT formatted disk. This code is 40kB of hand crafted code and installed=
 using:
>
> gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
>
> The partition itself must be created as
>
> gpart add -s 222 -a 4k -t freebsd-boot -l boot0 ada0
>
>
> B. For older BIOS systems without knowledge of GPT, the pmbr is install=
ed in some other special location on the disk, outside any partitions. Th=
is is 512 bytes of code and does nothing other than pretend to be MBR to =
tell the old BIOS (or Windows?) to not mess with this disk.
>
> C. Once gptzfsboot is executing on the CPU, it is able to mount a ZFS p=
ool in read only mode. Enough to read the kernel and get a full ZFS imple=
mentation in place.
>
>
>
> Questions
>
> 1. If I have two zpools on this machine, how does gptzfsboot know which=
 one to boot the kernel from? Does it just start by iterating through all=
 zfs partitions until it finds the zpool metadata cache which give it eno=
ugh information to mount some zpool? In other words, does it pick a rando=
m pool from what it can access?
It looks at the pools until it finds "bootfs" defined on one of them,=20
which tells it where to boot from.
>
> 2. How does it know where to find the kernel once it mounts the ZFS poo=
l, or is the /boot/kernel location hardcoded into the gptzfsboot code?
Once it has found "bootfs" it expects the usual structures to be there=20
(e.g. the "/boot" directory)
>
> 3. Once the kernel is booted, then it can read /boot/loader.conf. In th=
ere we can see vfs.root.mountfrom=3D"zfs:tank" but isn't this a bit late?=
 We've already mounted this pool and loaded the kernel from it. Can we om=
it vfs.root.mountfrom entirely?
I do not have it in my /boot/loader.conf file.

I have "beadm" set up which allows me to snapshot the existing running=20
system structure off my root pool (a separate pool from where data=20
lives) and then start it in a jail and perform an update on it there.  I =

can then swap to it on the next boot if I wish while retaining the=20
previous system copy (in case something goes wrong.)
>
>
> I understand grub a little better, since in that case you configure, th=
en install a new configured grub artifact into the right places. But with=
 the FreeBSD boot process there seems to be no configuration of the first=
 stage boot loader.
>
>
> Thanks very much for helping me to understand this boot process in more=
 detail
>
>
> Cheers
> Ari
>
>

--=20
-- Karl
karl@denninger.net



--------------ms020307060207000604080807
Content-Type: application/pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIFTzCC
BUswggQzoAMCAQICAQgwDQYJKoZIhvcNAQEFBQAwgZ0xCzAJBgNVBAYTAlVTMRAwDgYDVQQI
EwdGbG9yaWRhMRIwEAYDVQQHEwlOaWNldmlsbGUxGTAXBgNVBAoTEEN1ZGEgU3lzdGVtcyBM
TEMxHDAaBgNVBAMTE0N1ZGEgU3lzdGVtcyBMTEMgQ0ExLzAtBgkqhkiG9w0BCQEWIGN1c3Rv
bWVyLXNlcnZpY2VAY3VkYXN5c3RlbXMubmV0MB4XDTEzMDgyNDE5MDM0NFoXDTE4MDgyMzE5
MDM0NFowWzELMAkGA1UEBhMCVVMxEDAOBgNVBAgTB0Zsb3JpZGExFzAVBgNVBAMTDkthcmwg
RGVubmluZ2VyMSEwHwYJKoZIhvcNAQkBFhJrYXJsQGRlbm5pbmdlci5uZXQwggIiMA0GCSqG
SIb3DQEBAQUAA4ICDwAwggIKAoICAQC5n2KBrBmG22nVntVdvgKCB9UcnapNThrW1L+dq6th
d9l4mj+qYMUp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IG2BgsqhkiG
9w0BCRACCzGBpqCBozCBnTELMAkGA1UEBhMCVVMxEDAOBgNVBAgTB0Zsb3JpZGExEjAQBgNV
BAcTCU5pY2V2aWxsZTEZMBcGA1UEChMQQ3VkYSBTeXN0ZW1zIExMQzEcMBoGA1UEAxMTQ3Vk
YSBTeXN0ZW1zIExMQyBDQTEvMC0GCSqGSIb3DQEJARYgY3VzdG9tZXItc2VydmljZUBjdWRh
c3lzdGVtcy5uZXQCAQgwDQYJKoZIhvcNAQEBBQAEggIAas2vta9bMk8kSryrEXsHVvxpmDRg
u8LmDRJpXtm8J6b7swBut4tzmq/0YOAixUQqLddBAACHIhN/Xyl+iK1o1O77aUdlYHn8XEMA
DmEALknH1pi91Fow0g5kDuOklYa9v7mDkQl8Y8HPv3Ey+zAfJ8HEaDZjq3Sql469WaSWgfo4
wyZWzI2NabYvEYegBkC1cdMam5WpyFrgWBs98zwgQozQ18dqCPlSCjhJPxexoF2VaA2PTPK9
1XPc/gUa7B6m2S2PfyRYC12/ps259JBlEl+aPmv0b73EYIKE/F5tOXljoQzuXPrn+MJQFlZP
EH2VDEdYEvaddsPTjFEooU/Z+xFWvRhrgHt1SpeLYtMC9Cets0TY26TrsNIbVdPoEYcox/F0
9JLNmg6vgUEJ4heGKjO4Lm4aEH25z9gLIt8rdseoexrDUOeuDFrRz9kHhwvb2OZn6lBjBTK5
EBL05tAWwNVQ0jTGFqeL+t/xSwwzc0IiTAAOgf3jYFd1JDkgu2gbJuZS1TlJIAk6/G/pbEFg
0GuYCZnXhSocHH4rG7nhAcCYqytS+k3SF94XkBzekL5d67Td5air0DVnCX84rVXd6lRdZEr+
3aDfHEZyIVZZDKKJtEF9FVEs/tXDGy0E42Zd5Qg6pi8KTKvHIIFpRR0/WlAprP7yiZUxQQPA
W/H1gTAAAAAAAAA=
--------------ms020307060207000604080807--





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