From owner-freebsd-fs@FreeBSD.ORG Tue Aug 28 02:46:47 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 DD834106564A; Tue, 28 Aug 2012 02:46:47 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward5.mail.yandex.net (forward5.mail.yandex.net [IPv6:2a02:6b8:0:602::5]) by mx1.freebsd.org (Postfix) with ESMTP id 560A28FC18; Tue, 28 Aug 2012 02:46:47 +0000 (UTC) Received: from smtp4.mail.yandex.net (smtp4.mail.yandex.net [77.88.46.104]) by forward5.mail.yandex.net (Yandex) with ESMTP id BE06912019B6; Tue, 28 Aug 2012 06:46:45 +0400 (MSK) Received: from smtp4.mail.yandex.net (localhost [127.0.0.1]) by smtp4.mail.yandex.net (Yandex) with ESMTP id 9B1E15C056D; Tue, 28 Aug 2012 06:46:45 +0400 (MSK) Received: from ns.kirov.so-ups.ru (ns.kirov.so-ups.ru [178.74.170.1]) by smtp4.mail.yandex.net (nwsmtp/Yandex) with ESMTP id ki9W23H2-kj9in9Fh; Tue, 28 Aug 2012 06:46:45 +0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1346122005; bh=T7uJpLEAqCIH0T8Dl9VyPy6pW3SkMoWz57UFOU0iLfA=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:X-Enigmail-Version:Content-Type: Content-Transfer-Encoding; b=hxT9+SqWfwBdkTnpiTvk7ViBmy/H5XLOm/xQz94EWDOxKcnKAeQpeEHYQr9B8EjWP HIjEml3IL3q0kXNa3rWqA2UfpkQEN0zd7tyYwibmC2FGwzgDVZkCsdWLyD8uujkk9J fIwltazl77vIsLmBH6R5Du+YrUQYbUIKRW7Ggicc= Message-ID: <503C3114.3080000@yandex.ru> Date: Tue, 28 Aug 2012 06:46:44 +0400 From: "Andrey V. Elsukov" User-Agent: Mozilla Thunderbird 1.5 (FreeBSD/20051231) MIME-Version: 1.0 To: Jeremie Le Hen References: <20120827070210.GA798@felucia.tataz.chchile.org> <503B4521.9080603@yandex.ru> <20120827150648.GE32062@felucia.tataz.chchile.org> In-Reply-To: <20120827150648.GE32062@felucia.tataz.chchile.org> X-Enigmail-Version: 1.4.2 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Cc: 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: Tue, 28 Aug 2012 02:46:48 -0000 On 27.08.2012 19:06, Jeremie Le Hen wrote: >> 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. Probably your disk has 4k sectors and gpart did an automatic alignment. You can disable automatic alignment by specifying "-a 1" when you create partition. But it will be better if you create BSD slice already aligned. The problem is that automatic alignment doesn't work with MBR :) You need to calculate start offset based on disk geometry and sectorsize. # gpart list ada0 | grep fwsectors I think you will get 63, so your alignment value will be 63*8 = 504. To create aligned BSD slice you can use this command: # gpart add -t freebsd -a 504 ada0 -- WBR, Andrey V. Elsukov