Date: Thu, 28 Apr 2011 07:40:15 -0700 From: Freddie Cash <fjwcash@gmail.com> To: Edho P Arief <edhoprima@gmail.com> Cc: freebsd-stable@freebsd.org, Daniel Kalchev <daniel@digsys.bg> Subject: Re: correct way to setup gmirror on 7.4? Message-ID: <BANLkTimAxZNrT63kDOPTN%2Bq1wOoQqf3Q5g@mail.gmail.com> In-Reply-To: <BANLkTikUn5jRSDWmvpHV9nGuLyKT5KHg6A@mail.gmail.com> References: <BANLkTimCFcw_Oyp9RmBhfCZ9-QORUQEwfA@mail.gmail.com> <xn0hddht75xo97q00a@news.gmane.org> <20110427221554.GB22139@lava.net> <BANLkTikDjPLijvWrpK4y48fp5q6c2LnpqA@mail.gmail.com> <4DB9303E.9090305@digsys.bg> <BANLkTikUn5jRSDWmvpHV9nGuLyKT5KHg6A@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Apr 28, 2011 at 2:20 AM, Edho P Arief <edhoprima@gmail.com> wrote: > On Thu, Apr 28, 2011 at 4:15 PM, Daniel Kalchev <daniel@digsys.bg> wrote: >> >> >> On 28.04.11 01:30, Freddie Cash wrote: >>> >>> gmirror doesn't touch the start of the disk, but saves it's metadata >>> in the last sector of the disk, and creates a new GEOM provider that's >>> one sector shorter. >>> >>> GPT stores it's partition table in the first sector of the disk, and >>> saves a backup copy of it in the last sector of the disk. >> >> This looks like layering issue to me. >> >> In theory, both gmirror and gpt should work on 'providers'. So if you gi= ve >> an gmirrored provider to gpt it should touch the last sector of the gmir= ror, >> but not the last sector of the disk - and not complain. It should not ev= en >> be able to see the last sector of the real disk. >> >> Is this hard to fix? >> > > I believe it goes like this > > gmX: | gpt | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0data =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 | gpt | > > which in actual disk goes like this: > > adY: | gpt | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0data =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 | gpt | gmirror | > > so geom read gpt in the first sector but doesn't find it in the last sect= or. Correct. The layering is not, in itself, the issue. The issue is that the loader or kernel or whatever reads the first sector of the disk, finds a GPT so it then looks for the backup GPT in the last physical sector of the disk and doesn't find it. At this point, gmirror is not loaded (or not noticed, since there's nothing in the first sector of the disk to show it's a mirror). Once gmirror is loaded, then the GPT stops complaining as the first and last sectors of the gmirrror provider have the GPT tables. My completely WAG to a fix would be for all GEOM classes to store metadata in the last *and* first sector of the provider. Thus, allowing for proper stacking/layering, and proper, orderly tasting of providors: adX: | gmirror | gpt | data | gpt | gmirror | And to get complicated: adX: | glabel | gmirror | gpt | data | gpt | gmirror | glabel | And so on. Then the loader or kernel or whatever just starts at the beginning of the disk and reads metadata as needed. Granted, there may be reasons why it wasn't done like this in the beginning, but my non-GEOM programmer's eyes can't see any. --=20 Freddie Cash fjwcash@gmail.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BANLkTimAxZNrT63kDOPTN%2Bq1wOoQqf3Q5g>