glabel on 9-BETA1
Mark Saad
nonesuch at longcount.org
Tue Aug 16 21:15:22 UTC 2011
On Tue, Aug 16, 2011 at 5:01 PM, Test Rat <ttsestt at gmail.com> wrote:
> Mark Saad <nonesuch at longcount.org> writes:
>
>> All
>> I was testing out an old bug and I am not sure if there is any known
>> work-around on 9-BETA/HEAD
>>
>> Here is the issue. Install a new server , have it boot into
>> multi-user mode. Then attempt to use glabel to label the root slice
>>
>> root at 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
> ===================================================================
> --- sys/geom/geom_subr.c (revision 224657)
> +++ sys/geom/geom_subr.c (working copy)
> @@ -807,7 +819,7 @@ g_access(struct g_consumer *cp, int dcr, int dcw,
> pp, pp->name);
>
> /* If foot-shooting is enabled, any open on rank#1 is OK */
> - if ((g_debugflags & 16) && pp->geom->rank == 1)
> + if ((g_debugflags & 16))
> ;
> /* If we try exclusive but already write: fail */
> else 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 at 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 Pass#
/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 ?
--
mark saad | nonesuch at longcount.org
More information about the freebsd-hackers
mailing list