Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Aug 2011 17:15:20 -0400
From:      Mark Saad <nonesuch@longcount.org>
To:        freebsd-hackers@freebsd.org
Subject:   Re: glabel on 9-BETA1
Message-ID:  <CAMXt9Nb0JSUO7xm7H%2Bij8AKu%2BtKu6gPOZLXZDLbJuFGz9C9mBQ@mail.gmail.com>
In-Reply-To: <86wred136f.fsf@gmail.com>
References:  <CAMXt9NboLSTSRqZW2ZUD=BWdq7agbZFA6UeLrB_oOSSGbw%2BuwQ@mail.gmail.com> <86wred136f.fsf@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Aug 16, 2011 at 5:01 PM, Test Rat <ttsestt@gmail.com> wrote:
> Mark Saad <nonesuch@longcount.org> writes:
>
>> All
>> =C2=A0I was testing out an old bug and I am not sure if there is any kno=
wn
>> work-around on 9-BETA/HEAD
>>
>> Here is the =C2=A0issue. =C2=A0Install a new server , have it boot into
>> multi-user mode. Then attempt to use glabel to label the root slice
>>
>> root@blindness:~# glabel label rootfs ada0p4
>> glabel: Can't store metadata on ada0p4: Operation not permitted.
>>
>> In 7.2 and prior there was a sysctl that could be tweaked to allow for
>> this to work , kern.geom.debugflag set to 16 would allow this to work.
>>
>> So my question is this. Should there be any reason why "glabel label
>> name device" on the root slice cause an issue
>> when the slice is mounted rw ?
>>
>> Is this a bug ?
>
> It's a known feature[1], see geom(4) or try below diff.
>
> [1] http://lists.freebsd.org/pipermail/freebsd-fs/2010-April/008290.html
>
> %%
> Index: sys/geom/geom_subr.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- sys/geom/geom_subr.c =C2=A0 =C2=A0 =C2=A0 =C2=A0(revision 224657)
> +++ sys/geom/geom_subr.c =C2=A0 =C2=A0 =C2=A0 =C2=A0(working copy)
> @@ -807,7 +819,7 @@ g_access(struct g_consumer *cp, int dcr, int dcw,
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pp, pp->name);
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0/* If foot-shooting is enabled, any open on ra=
nk#1 is OK */
> - =C2=A0 =C2=A0 =C2=A0 if ((g_debugflags & 16) && pp->geom->rank =3D=3D 1=
)
> + =C2=A0 =C2=A0 =C2=A0 if ((g_debugflags & 16))
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0/* If we try exclusive but already write: fail=
 */
> =C2=A0 =C2=A0 =C2=A0 =C2=A0else if (dce > 0 && pw > 0)
> %%
>
Ok so I am not using glabel as it was originally designed or intended
but I was / am using in it in production to label slices.
IMHO it works very well for doing this.  Here is an example from a
7.3-RELEASE servers of how I am using it.


[root@wfmu2~]# glabel list
Geom name: da1s1
Providers:
1. Name: label/mysql/data
   Mediasize: 146778668544 (137G)
   Sectorsize: 512
   Mode: r1w1e1
   secoffset: 0
   offset: 0
   seclength: 286677087
   length: 146778668544
   index: 0
Consumers:
1. Name: da1s1
   Mediasize: 146778669056 (137G)
   Sectorsize: 512
   Mode: r1w1e2

Geom name: da0s1a
Providers:
1. Name: label/rootfs
   Mediasize: 140336217600 (131G)
   Sectorsize: 512
   Mode: r1w1e1
   secoffset: 0
   offset: 0
   seclength: 274094175
   length: 140336217600
   index: 0
Consumers:
1. Name: da0s1a
   Mediasize: 140336218112 (131G)
   Sectorsize: 512
   Mode: r1w1e2

Geom name: da0s1b
Providers:
1. Name: label/SWAP
   Mediasize: 2147483136 (2.0G)
   Sectorsize: 512
   Mode: r1w1e0
   secoffset: 0
   offset: 0
   seclength: 4194303
   length: 2147483136
   index: 0
Consumers:
1. Name: da0s1b
   Mediasize: 2147483648 (2.0G)
   Sectorsize: 512
   Mode: r1w1e1

Geom name: da0s1d
Providers:
1. Name: label/var
   Mediasize: 4294966784 (4.0G)
   Sectorsize: 512
   Mode: r1w1e1
   secoffset: 0
   offset: 0
   seclength: 8388607
   length: 4294966784
   index: 0
Consumers:
1. Name: da0s1d
   Mediasize: 4294967296 (4.0G)
   Sectorsize: 512
   Mode: r1w1e2

So what I am getting at is in 9 I can not label the system in the same
way. So this may be a limitation of GPT but I am not sure .

The reason why I was doing this is to use a standard format for fstab
. Every server gets the same starting point

Here is the fstab from the same server

# Device                Mountpoint      FStype  Options         Dump    Pas=
s#
/dev/label/rootfs       /               ufs     rw              1       1
/dev/label/var          /var            ufs     rw              2       2
/dev/label/SWAP         none            swap    sw              0       0
/dev/label/mysql/data   /usr/local/mysql        ufs     rw      1       1


Is there any reason I can not do this in 9, is it just GPT thats
preventing this  ?

--=20
mark saad | nonesuch@longcount.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMXt9Nb0JSUO7xm7H%2Bij8AKu%2BtKu6gPOZLXZDLbJuFGz9C9mBQ>