glabel on 9-BETA1

2011-08-16 Thread Mark Saad
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@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 ?

-- 
mark saad | nones...@longcount.org
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: glabel on 9-BETA1

2011-08-16 Thread Test Rat
Mark Saad nones...@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@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)
%%
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: glabel on 9-BETA1

2011-08-16 Thread Mark Saad
On Tue, Aug 16, 2011 at 5:01 PM, Test Rat ttse...@gmail.com wrote:
 Mark Saad nones...@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@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@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

# DeviceMountpoint  FStype  Options DumpPass#
/dev/label/rootfs   /   ufs rw  1   1
/dev/label/var  /varufs rw  2   2
/dev/label/SWAP noneswapsw  0   0
/dev/label/mysql/data   /usr/local/mysqlufs rw  1   1


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

-- 
mark saad | nones...@longcount.org
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: glabel on 9-BETA1

2011-08-16 Thread Andrey V. Elsukov
On 17.08.2011 0:10, Mark Saad wrote:
 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 ?

No. It isn't.
When you are doing `glabel label` you overwriting last sector of given
device with glabel's metadata. So you potentially can destroy some data
in it. Using kern.geom.debugflags=16 is a bad practice. The right way is
creating label before creation of file system and installing OS.
Also you can use UFS labels (see tunefs(8)).

-- 
WBR, Andrey V. Elsukov



signature.asc
Description: OpenPGP digital signature


Re: glabel on 9-BETA1

2011-08-16 Thread Sean

On Wed, 17 Aug 2011, Andrey V. Elsukov wrote:


On 17.08.2011 0:10, Mark Saad wrote:

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 ?


No. It isn't.
When you are doing `glabel label` you overwriting last sector of given
device with glabel's metadata. So you potentially can destroy some data
in it. Using kern.geom.debugflags=16 is a bad practice. The right way is
creating label before creation of file system and installing OS.
Also you can use UFS labels (see tunefs(8)).




Or in this case, GPT labels, which are more flexible in that they can apply
to non-UFS partitions as well, such as swap. 'gpart show -l' and 'gpart
modify' ... /dev/gpt/ is where the labels show up.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org