# Does glabel clobber gptid's?



## jem (Oct 15, 2010)

When a GPT partition is created, a randomly generated unique gptid of the form 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' is assigned to it.  This is presented under /dev/gptid/.

If you then use glabel(8) to create an arbitrary GPT partition label of the form /dev/gpt/whatever, does this clobber the original gptid?  I ask because 'glabel status' output displays the gptid for partitions that have never been explicitly glabelled, but only the GPT partition label for those that have.

If so, is there a way to generate a new random gptid and write it back to the partition entry, replacing the GPT partition label?


On another related point, my swap partitions had GPT labels of /dev/gpt/swap0 and /dev/gpt/swap1.  I changed fstab to refer to them by their real device names, /dev/ada0p2 and /dev/ada1p2, and now the GPT labels appear to have disappeared entirely, despite me never explicitly removing them.  Why has this happened?


----------



## phoenix (Oct 15, 2010)

The way GEOM labelling works is based on layers (as with everything GEOM).

If you label a disk (bottom layer) and mount the label, then glabel will show you everything below the label (thus you have /dev/label/whatever and /dev/whatever).

If you label a disk and mount the disk device, then glabel will hide all the labels higher up the stack (thus you have /dev/whatever and nothing else).

glabel sees "down", not up.

There's a discussion about this on the freebsd-stable mailing list.  Search for subject "Label question ... why does ufs label vanish on mount".

There's discussion of changing this behaviour so that all labels are visible at all times, but there's a few data quality issues that need to be worked out (ie what happens is you label a disk, mount the physical device node, and change the label).


----------

