From owner-freebsd-stable@FreeBSD.ORG Tue May 26 17:31:12 2009 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 562F11065670 for ; Tue, 26 May 2009 17:31:12 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from itchy.rabson.org (router.rabson.org [80.177.232.241]) by mx1.freebsd.org (Postfix) with ESMTP id 10AE88FC1C for ; Tue, 26 May 2009 17:31:11 +0000 (UTC) (envelope-from dfr@rabson.org) Received: by itchy.rabson.org (Postfix, from userid 80) id CBE765DB7; Tue, 26 May 2009 18:06:15 +0100 (BST) To: Andriy Gapon MIME-Version: 1.0 Date: Tue, 26 May 2009 18:06:15 +0100 From: Doug Rabson In-Reply-To: <4A1C1F5F.2060907@icyb.net.ua> References: <29579856-69F7-4CDC-A52A-B414A40180ED@yellowspace.net> <4A1B0B4F.1020106@h3q.com> <18972.5870.795005.186542@already.dhcp.gene.com> <4A1C18CC.7080902@icyb.net.ua> <18972.7173.216763.407615@already.dhcp.gene.com> <4A1C1F5F.2060907@icyb.net.ua> Message-ID: X-Sender: dfr@rabson.org User-Agent: RoundCube Webmail/0.2.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="UTF-8" Cc: FreeBSD Stable Mailing List , hartzell@alerce.com Subject: Re: ZFS boot on zfs mirror X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 17:31:12 -0000 On Tue, 26 May 2009 19:57:03 +0300, Andriy Gapon wrote: > on 26/05/2009 19:42 George Hartzell said the following: >> I'm still confused about the two parts of zfsboot and what's magical >> about seeking to 1024. > > Can't help with answer to this, but cc-ing the one who can (I think). > I am interested too :-) This is due to the primitive DOS boot sequence. Basically the BIOS loads the first sector of the partition and executes it. For zfsboot, that is the first 512 bytes of /boot/zfsboot. The next stage of the bootstrap is tucked away in a convenient hole in the ZFS on-disk formwat which is located just after the ZFS metadata - this is the seek=1024 part. The first 512 byte part is a tiny assembler program that loads the rest into memory and executes it. The second part is large enough and smart enough to understand the ZFS filesystem format directly and it loads /boot/loader directly from the filesystem and transfers control to that. The third stage (/boot/loader) is what puts up the boot menu and loads the kernel etc.