From owner-freebsd-fs@FreeBSD.ORG Mon Aug 27 15:06:58 2012 Return-Path: Delivered-To: freebsd-fs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A366106566B; Mon, 27 Aug 2012 15:06:58 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [IPv6:2a01:e0c:1:1599::14]) by mx1.freebsd.org (Postfix) with ESMTP id C03068FC1F; Mon, 27 Aug 2012 15:06:55 +0000 (UTC) Received: from endor.tataz.chchile.org (unknown [82.233.239.98]) by smtp5-g21.free.fr (Postfix) with ESMTP id 94220D480D5; Mon, 27 Aug 2012 17:06:49 +0200 (CEST) Received: from felucia.tataz.chchile.org (felucia.tataz.chchile.org [192.168.1.9]) by endor.tataz.chchile.org (Postfix) with ESMTP id 7F5EE3F7; Mon, 27 Aug 2012 17:06:48 +0200 (CEST) Received: by felucia.tataz.chchile.org (Postfix, from userid 1000) id 4A3D6109B4; Mon, 27 Aug 2012 15:06:48 +0000 (UTC) Date: Mon, 27 Aug 2012 17:06:48 +0200 From: Jeremie Le Hen To: "Andrey V. Elsukov" Message-ID: <20120827150648.GE32062@felucia.tataz.chchile.org> References: <20120827070210.GA798@felucia.tataz.chchile.org> <503B4521.9080603@yandex.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <503B4521.9080603@yandex.ru> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Jeremie Le Hen , freebsd-fs@FreeBSD.org Subject: Re: Cannot get zfsboot prompt X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Aug 2012 15:06:58 -0000 On Mon, Aug 27, 2012 at 02:00:01PM +0400, Andrey V. Elsukov wrote: > > When i'm configuring ZFS-only system, usually i do the following steps: > 1. zpool create -R /mnt bsdroot ada0s1a > 2. Create several filesystems and install the system. > 3. zpool set bootfs=bsdroot/root bsdroot > 4. zpool set cachefile=/mnt/boot/zfs/zpool.cache bsdroot > 5. echo 'vfs.root.mountfrom="zfs:bsdroot/root"' >> /boot/loader.conf > echo 'zfs_load="YES"' >> /boot/loader.conf > 6. echo 'zfs_enable="YES"' >> /etc/rc.conf > 7. Add swap entry to the /etc/fstab > 8. zpool set mountpoint=none bsdroot/root > 9. zpool set mountpoint=none bsdroot > 10. Write bootcode: > > dd if=/mnt/boot/zfsboot of=/dev/ada0s1 count=1 > > dd if=/mnt/boot/zfsboot of=/dev/ada0s1 skip=1 seek=1024 > > I guess your ada0s1a partition has non zero offset, and second > part of zfsboot bootcode has been written into wrong place. > > AFAIK, the first part of the zfsboot does read the second part > from the 1024 sector of the active FreeBSD slice in the MBR. Yes I agree this is probably where the catch is. But note that contrary to your procedure, I laid zfsboot2 from ada0s1a. The first partition of my BSD label indeed starts at sector 1. rescue-bsd# gpart show ada0s1 => 0 1953525105 ada0s1 BSD (931G) 0 1 - free - (512B) 1 1951799000 1 freebsd-zfs (930G) 1951799001 1726096 4 freebsd-swap (842M) 1953525097 8 - free - (4.0k) >From what I undestand from sys/boot/i386/zfsboot/zfsldr.S, zfsboot1 expects zfsboot2 to be at offset 1024 for the start of the first FreeBSD (0xA5) MBR active slice (fall-back to non-active). 1024 sectors is not chosen randomly, this is because in zpools, the boot block is located after the two heading vdev label replicas which are 256KB each. Given my partition in shifted by one sector, zfsboot2 is shifted by one sector as well so zfsboot1 doesn't find it. Do you know if this topic is documented somewhere? I couldn't find anything when I needed it. Also, why does gpart(8) enforce a one sector offset for partition inside a BSD scheme? I tried to set an offset to 0 without any effect. Regards, -- Jeremie Le Hen Scientists say the world is made up of Protons, Neutrons and Electrons. They forgot to mention Morons.