Date: Tue, 28 Aug 2012 06:46:44 +0400 From: "Andrey V. Elsukov" <bu7cher@yandex.ru> To: Jeremie Le Hen <jlh@FreeBSD.org> Cc: freebsd-fs@FreeBSD.org Subject: Re: Cannot get zfsboot prompt Message-ID: <503C3114.3080000@yandex.ru> In-Reply-To: <20120827150648.GE32062@felucia.tataz.chchile.org> References: <20120827070210.GA798@felucia.tataz.chchile.org> <503B4521.9080603@yandex.ru> <20120827150648.GE32062@felucia.tataz.chchile.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?503C3114.3080000>