From owner-freebsd-geom@FreeBSD.ORG Tue Jan 18 17:14:25 2011 Return-Path: Delivered-To: freebsd-geom@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 090A91065670 for ; Tue, 18 Jan 2011 17:14:25 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id B2E448FC12 for ; Tue, 18 Jan 2011 17:14:24 +0000 (UTC) Received: by yxh35 with SMTP id 35so2469881yxh.13 for ; Tue, 18 Jan 2011 09:14:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:from :date:x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=gvZCY5VFtocaVZ7h2B48v+omMlmbU6ntYYrCpJ9nNY4=; b=fCLCtTu8qrHmExGp7n4J5K56QsIIKBYhi1oUiLLsATOi4NGA2UndzElNW0jkmGglMe OFAs3qCaOg02w6NaGyyCKYqgT+nuWoR/zlnj+J/TP53dOj61Hn9MmBY+/IhapD5giPx1 Qrv9D+uuXvUR6viNheW0AgpTqFGw7N0EWhAdY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=qyfk6QODtbpc7pIKmVzGseVBnwRsO9TwtLX0AcAxySjG25Wl6RICuHTOfyF7BlD9OT J/IqAaUx0Lp2xyjI5RA0DwZGf/+PLs4H3h93bAoJkfNrCVBzmHM1zxUMyraOrNEtuahr +pR7WXihT7WvfXL7PCFg6UYqLgZ/tPw9uBJq8= Received: by 10.151.78.6 with SMTP id f6mr1256055ybl.41.1295369432522; Tue, 18 Jan 2011 08:50:32 -0800 (PST) MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.150.182.16 with HTTP; Tue, 18 Jan 2011 08:49:52 -0800 (PST) In-Reply-To: <1211987575.20110117170902@serebryakov.spb.ru> References: <1686083494.20110113182418@serebryakov.spb.ru> <1811347380.20110113213700@serebryakov.spb.ru> <234432652.20110117163922@serebryakov.spb.ru> <1211987575.20110117170902@serebryakov.spb.ru> From: Ivan Voras Date: Tue, 18 Jan 2011 17:49:52 +0100 X-Google-Sender-Auth: R6VlCjcPAEOX5o8egUHopABYbG4 Message-ID: To: Lev Serebryakov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-geom@freebsd.org Subject: Re: Broken gmirror: why /dev/ufs is empty when geom_mirror is not loaded? X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Jan 2011 17:14:25 -0000 On 17 January 2011 15:09, Lev Serebryakov wrote: > =C2=A0 Let imagine /dev/ad0s1a and /dev/ad1s1a both have, say, 1024 > =C2=A0sectors. They are mirrored as "mirror/rootfs". It should have size > =C2=A01023 sectors, am I right? 1 sector is spent on metadata and can not= be > =C2=A0accessed via /dev/mirror/gm0. > > =C2=A0 UFS2 is created on /dev/mirror/gm0, with volume label "rootfs" > =C2=A0so it records file system size as "1023 sectors", Ok? Well... it depends. As I see it, the UFS file system size is calculated based on block size, so the actual size would not be 1024, but 1024-32 or something like that, which brings me to the next point... > =C2=A0 When geom_mirror is loaded and "win" tasting of ad?s1a, geom_label > =C2=A0reads label from /dev/mirror/gm0 and shows proper > =C2=A0"/dev/ufs/rootfs" and "/dev/ufsid/whatever" with proper sizes "1023 > =C2=A0sectors". > > =C2=A0 When geom_mirror is not loaded, but geom_label is, now it will not > =C2=A0show "/dev/ufs/rootfs" because ad?s1a.size !=3D rootf.size, am I ri= ght? > > =C2=A0 If change geom_label to create labels in such cases (simply remove > =C2=A0sizes check in current code), there will be problem with geom_mirro= r > =C2=A0loaded AFTER geom_label -- it could pickup mirror component via > =C2=A0label, not via device itself. > > =C2=A0 But if we remove this check AND change geom_label in such way, as > =C2=A0it will create provider based on UFS size (not underlying provider > =C2=A0size), it will work always. When there is no geom_mirror labels wil= l > =C2=A0be created but it will be impossible to pickup such label as > =C2=A0component of mirror, because label-provider will not contain mirror > =C2=A0metadata. I don't think this is a general enough solution. Other file systems than UFS may not record file system size at all, or maybe record it even more inprecisely than UFS. Additionally, glabel would have to be restructured a bit to support that. > =C2=A0 And there is one more problem: it is almost always possible to > =C2=A0create mirror AFTER file system (add mirror to existing installatio= n > =C2=A0without re-creating FSes), but it will have incorrect FS size in > =C2=A0metadata and here is no way to "shrink" FS even with one sector. An= d, > =C2=A0yes, it such case current geom_label implementation will create > =C2=A0labels from mirror components (size check will be passed), and allo= ws > =C2=A0geom_mirror to use labels as components. Complete mess :( And > =C2=A0creation mirror on live system looks like useful feature. I think this would be solved by my other proposal :)