Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Jan 2011 17:49:52 +0100
From:      Ivan Voras <ivoras@freebsd.org>
To:        Lev Serebryakov <lev@serebryakov.spb.ru>
Cc:        freebsd-geom@freebsd.org
Subject:   Re: Broken gmirror: why /dev/ufs is empty when geom_mirror is not loaded?
Message-ID:  <AANLkTinUjN70FsVApYjP=bLu1W9vb0DaNLvLs%2BX2N=CH@mail.gmail.com>
In-Reply-To: <1211987575.20110117170902@serebryakov.spb.ru>
References:  <1686083494.20110113182418@serebryakov.spb.ru> <1811347380.20110113213700@serebryakov.spb.ru> <ih1ga3$tdv$1@dough.gmane.org> <234432652.20110117163922@serebryakov.spb.ru> <ih1h86$1t3$1@dough.gmane.org> <1211987575.20110117170902@serebryakov.spb.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On 17 January 2011 15:09, Lev Serebryakov <lev@serebryakov.spb.ru> 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 :)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinUjN70FsVApYjP=bLu1W9vb0DaNLvLs%2BX2N=CH>