gpt label under gmirror, not showing the gpt label, but the gpt partition

Hi guys,

Today I was in the process of creating a gmirror for the swap partition of 2 disks and I went along with using the GPT label:
Code:
[...]
gpart add -s 4G -t freebsd-swap -l swap00 ad0
gpart add -s 4G -t freebsd-swap -l swap01 ad1
The labels show up in /dev/gpt/ but when I use them for the gmirror, I get the partition name instead of the label (ex: ad0p2 instead of swap00).

My cmd's:
Code:
gmirror label -vb round-robin swap gpt/swap00
gmirror insert swap gpt/swap01

Result:
Code:
       Name    Status  Components
mirror/swap  COMPLETE  ad0p2
                       ad1p2

Am I missing something here ?


PS: not sure if I posted this already or not.
 
gmirror status goes through geom(8). I believe this is a lower level that doesn't know about GPT labels, but they're working because it found the correct partitions. Test it: shut down and swap cables so the drives are renumbered. It should come up without rebuilding or complaining about the mirror.
 
First of all, nice new color wblock.

ATM, I'm thinking if we really need glabels if we can simply use the gpart labels (even if we see "ad0p2" instead of a nice and shinny label). Nevertheless, would be nice to be able to use the GPT labels and not (g)label something that was already labeled.
 
da1 said:
First of all, nice new color wblock.

Thanks!

ATM, I'm thinking if we really need glabels if we can simply use the gpart labels (even if we see "ad0p2" instead of a nice and shinny label). Nevertheless, would be nice to be able to use the GPT labels and not (g)label something that was already labeled.

The GPT labels are working--it's how the mirror partitions were found. I think it's just that GEOM happens at a lower level, and gmirror status is just a straight-through call to geom(8). So it's not showing the label name, but it is using the label to find the right thing. Like resolving a hostname to an IP address.

Even gpart(8) doesn't show labels by default, and it knows all about GPT labels.
 
Hi,

I tested your procedure on a VMWare virtual install:

Code:
# uname -a
FreeBSD restora.slu.se 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Thu Feb 17 02:41:51 UTC 2011     
root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64

gpart
Code:
# cleandrives ad0 ad1
Drive ad0 verified.
Drive ad1 verified.

This will irreversibly destroy partition- and filesystem data on drive(s):
ad0 ad1

USE WITH EXTREME CAUTION!
Do you confirm "yes/no": yes

Drive(s) cleaned.
# gpart create -s gpt ad0
ad0 created
# gpart create -s gpt ad1
ad1 created
# gpart add -t freebsd-swap -l swap00 ad0
ad0p1 added
# gpart add -t freebsd-swap -l swap01 ad1
ad1p1 added
# gmirror label -vb round-robin swap gpt/swap00
Metadata value stored on gpt/swap00.
Done.
# gmirror status
       Name    Status  Components
mirror/swap  COMPLETE  ad0p1
# gmirror insert swap gpt/swap01
# gmirror status
       Name    Status  Components
mirror/swap  DEGRADED  ad0p1
                       ad1p1 (6%)
# ls -lah /dev/gpt
total 2
dr-xr-xr-x   2 root  wheel   512B Sep 30 07:26 .
dr-xr-xr-x  10 root  wheel   512B Sep 30 09:21 ..
# gmirror deactivate swap ad1p1
# gmirror deactivate swap ad0p1
# gmirror status
# gpart delete -i 1 ad1
ad1p1 deleted
# gpart delete -i 1 ad0
ad0p1 deleted
# gpart destroy ad1
ad1 destroyed
# gpart destroy ad0
ad0 destroyed

glabel
Code:
# cleandrives ad0 ad1
Drive ad0 verified.
Drive ad1 verified.

This will irreversibly destroy partition- and filesystem data on drive(s):
ad0 ad1

USE WITH EXTREME CAUTION!
Do you confirm "yes/no": yes

Drive(s) cleaned.
# glabel label swap00 ad0
# glabel label swap01 ad1
# gmirror label -vb round-robin swap label/swap00
Metadata value stored on label/swap00.
Done.
# gmirror insert swap label/swap01

...

# gmirror status
       Name    Status  Components
mirror/swap  COMPLETE  label/swap00
                       label/swap01
# ls -lah /dev/label/
total 2
dr-xr-xr-x   2 root  wheel         512B Sep 30 07:50 .
dr-xr-xr-x  10 root  wheel         512B Sep 30 09:21 ..
crw-r-----   1 root  operator    0,  92 Sep 30 08:03 swap00
crw-r-----   1 root  operator    0,  94 Sep 30 08:03 swap01
# reboot

...

# gmirror status
       Name    Status  Components
mirror/swap  COMPLETE  label/swap00
                       label/swap01

I would suggest using glabel instead.

/Sebulon
 
For the moment, I am using glabels but would be nice to be able to use the GPT labels.
 
I have been having this problem myself in some testing cases I did at work, I have however found the solution to this. :)

When creating the mirror use the "-h" parameter, which will hardcode the providers' names into the metadata. This will solve the problem of disks appearing without GPT labels.

For reference, check the gmirror man page.

Also, Pawel used the "-h" paramenter in a ZFS HOWTO (gmirror used for swap) that he did two years ago, it can be found here: http://blogs.freebsdish.org/pjd/2010/08/06/from-sysinstall-to-zfs-only-configuration/
 
@Sebulon,

Would it be possible to obtain your update version of the "cleandrives" script? I saw what you posted here and here. But it would be nice to see your updated version if it's not too much to ask. Thanks.
 
Back
Top