From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 16 21:15:22 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43B211065675 for ; Tue, 16 Aug 2011 21:15:22 +0000 (UTC) (envelope-from nonesuch@longcount.org) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id CB4728FC1F for ; Tue, 16 Aug 2011 21:15:21 +0000 (UTC) Received: by fxe4 with SMTP id 4so347745fxe.13 for ; Tue, 16 Aug 2011 14:15:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.62.76 with SMTP id w12mr213995fah.123.1313529320770; Tue, 16 Aug 2011 14:15:20 -0700 (PDT) Received: by 10.223.74.143 with HTTP; Tue, 16 Aug 2011 14:15:20 -0700 (PDT) X-Originating-IP: [216.223.13.122] In-Reply-To: <86wred136f.fsf@gmail.com> References: <86wred136f.fsf@gmail.com> Date: Tue, 16 Aug 2011 17:15:20 -0400 Message-ID: From: Mark Saad To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: glabel on 9-BETA1 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 21:15:22 -0000 On Tue, Aug 16, 2011 at 5:01 PM, Test Rat wrote: > Mark Saad 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