From owner-freebsd-stable@FreeBSD.ORG Fri Jun 6 02:12:04 2014 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 53484348 for ; Fri, 6 Jun 2014 02:12:04 +0000 (UTC) Received: from ipmail06.adl2.internode.on.net (ipmail06.adl2.internode.on.net [IPv6:2001:44b8:8060:ff02:300:1:2:6]) by mx1.freebsd.org (Postfix) with ESMTP id D9D3B2531 for ; Fri, 6 Jun 2014 02:12:03 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlgXAMsikVM7p/kP/2dsb2JhbABZg19WqnUGmDpOAQIBgSB1hAMBAQQBJ1EGCQILGAkWDwkDAgECAQk8BgEMCAEBBYgxBw7MUhcEhVmJE4RBBI1mlCKLToNOWg Received: from eth4368.nsw.adsl.internode.on.net (HELO fish.ish.com.au) ([59.167.249.15]) by ipmail06.adl2.internode.on.net with ESMTP; 06 Jun 2014 11:41:26 +0930 Received: from ip-136.ish.com.au ([203.29.62.136]:58469) by fish.ish.com.au with esmtpsa (UNKNOWN:AES128-SHA:128) (Exim 4.76) (envelope-from ) id 1Wsjcm-0001oL-26; Fri, 06 Jun 2014 12:11:21 +1000 Message-ID: <53912346.7010207@ish.com.au> Date: Fri, 06 Jun 2014 12:11:18 +1000 From: Aristedes Maniatis User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:30.0) Gecko/20100101 Thunderbird/30.0 MIME-Version: 1.0 To: "Andrey V. Elsukov" , freebsd-stable Subject: Re: ZFS boot pool selection References: <53902B1D.8030200@ish.com.au> <53909B22.7000801@yandex.ru> In-Reply-To: <53909B22.7000801@yandex.ru> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jun 2014 02:12:04 -0000 On 6/06/2014 2:30am, Andrey V. Elsukov wrote: > On 05.06.2014 12:32, Aristedes Maniatis wrote: >> C. Once gptzfsboot is executing on the CPU, it is able to mount a ZFS >> pool in read only mode. Enough to read the kernel and get a full ZFS >> implementation in place. > > gptzfsboot is able to find needed partition and ZFS pool, then it search > the zfsloader or kernel and without mounting loads and starts it. > > http://www.freebsd.org/cgi/man.cgi?gpart#BOOTSTRAPPING > AFAIK, it will try to boot from the first ZFS pool that it can find. Then it would seem that the ZFS property bootfs is pretty much ignored. I know that I've never set it and everything seems to boot fine. Effectively it will load zfsloader from a random pool from all the pools it finds. Documentation is rather inconsistent too. One page [1] says bootfs should just point to the pool. Another page [2] that it points to the filesystem. I'm guessing this is inconsistent because that command actually does nothing. >> 2. How does it know where to find the kernel once it mounts the ZFS >> pool, or is the /boot/kernel location hardcoded into the gptzfsboot >> code? > > /boot/kernel/kernel is hardcoded. But when zfsloader is used, it has > some environment variables and you are able to change the kernel location. > >> 3. Once the kernel is booted, then it can read /boot/loader.conf. In >> there we can see vfs.root.mountfrom="zfs:tank" but isn't this a bit >> late? We've already mounted this pool and loaded the kernel from it. > > Kernel doesn't read loader.conf. The loader/zfsloader does that. > >> Can we omit vfs.root.mountfrom entirely? > > Yes. Right, so zfsloader reads loader.conf and uses vfs.root.mountfrom (if it exists) to work out which pool contains the kernel and root filesystem. If vfs.root.mountfrom doesn't exist then it tries the pool that already contains zfsloader. Which makes vfs.root.mountfrom a bit pointless. When the machine boots the kernel you get dmesg text scrolling by in a light font. I'm guessing that when that font changes to a darker colour that's the point at which the kernel has now mounted the system read-write and it ready to load userland. Should vfs.root.mountfrom and bootfs be removed from the latest ZFS howto instructions? Cheers Ari [1] # zpool set bootfs=zroot zroot https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/Mirror [2] # zpool set bootfs=zroot/ROOT/default zroot https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/9.0-RELEASE -- --------------------------> Aristedes Maniatis ish http://www.ish.com.au Level 1, 30 Wilson Street Newtown 2042 Australia phone +61 2 9550 5001 fax +61 2 9550 4001 GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A