From owner-freebsd-stable@FreeBSD.ORG Thu Apr 28 14:40:17 2011 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 32F2D106564A for ; Thu, 28 Apr 2011 14:40:17 +0000 (UTC) (envelope-from fjwcash@gmail.com) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id DFC348FC08 for ; Thu, 28 Apr 2011 14:40:16 +0000 (UTC) Received: by gyg13 with SMTP id 13so1365288gyg.13 for ; Thu, 28 Apr 2011 07:40:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=mohRovtg5E6l8Ut5MksvvKNaEx4eKT8vHVCl9/n5qJM=; b=w88xpm2twlb17tfnly05zpv979owUR5VD8swLo6rKEWIitY9Skn1SlBAe+CehG8DTy jjXKsAnE6uIzsxKb1/f4LkGR1hUgsfGuP8RSmQAtGaLpopUvGlWN0+42+jSPZ3LQx1LA Grghp96Bhg+LYQCRgwGX0voMj0CY9y6ecmqB4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=LAQjkRLW8cwIIPJoLLHJU/dIRAsvJZUKR0iWAd6F6v0riG92XCmFySbsk6+zzrURGI 4Q7XudzOdw2JAoLqJxOv0Q6dYRGum1yc4q+qA6sIYVs2EqjDZswr0ANThFmoIScjhFE6 m+mWrdaVARVxix+8lkyvVmximMtBMrCt4AhfY= MIME-Version: 1.0 Received: by 10.91.32.6 with SMTP id k6mr3168673agj.123.1304001615918; Thu, 28 Apr 2011 07:40:15 -0700 (PDT) Received: by 10.90.70.18 with HTTP; Thu, 28 Apr 2011 07:40:15 -0700 (PDT) In-Reply-To: References: <20110427221554.GB22139@lava.net> <4DB9303E.9090305@digsys.bg> Date: Thu, 28 Apr 2011 07:40:15 -0700 Message-ID: From: Freddie Cash To: Edho P Arief Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-stable@freebsd.org, Daniel Kalchev Subject: Re: correct way to setup gmirror on 7.4? 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: Thu, 28 Apr 2011 14:40:17 -0000 On Thu, Apr 28, 2011 at 2:20 AM, Edho P Arief wrote: > On Thu, Apr 28, 2011 at 4:15 PM, Daniel Kalchev 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