Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Apr 2023 23:47:01 -0400
From:      "Kevin P. Neal" <kpn@neutralgood.org>
To:        "Dan Mahoney (Ports)" <freebsd@gushi.org>
Cc:        questions@freebsd.org
Subject:   Re: filesystem labels?
Message-ID:  <ZDjMtdD9vu_QRdS2@neutralgood.org>
In-Reply-To: <A150BA2A-0669-4079-9978-44805FD4E851@gushi.org>
References:  <A150BA2A-0669-4079-9978-44805FD4E851@gushi.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Apr 12, 2023 at 08:58:22AM -0700, Dan Mahoney (Ports) wrote:
>    Hey all,
> 
>    I find that the handbook mentions glabel labels, but several other
>    places say don't use them.
> 
>    I managed to apply a gpt label to my new partition that I created using
>    only "gpart"
> 
>    The handbook mentions glabel labels, and tunefs labels, but says
>    nothing about GPT labels.

GPT labels only apply to GPT partitioned disks. The labels appear under
"/dev/gpt/". Mount filesystems using that device node in that directory.

UFS labels are similar, but only apply to UFS filesystems, and the labels
appear under "/dev/ufs/". Mount filesystems using that device node in that
directory.

It is possible to have a GPT label and a UFS label for the "same" partition.
Well, but the GPT label is for the partition and the UFS label is for the
filesystem, but in practice this is not a useful distinction.

Labels created with glabel add metadata to the end of a partition (or disk)
if I remember correctly. I believe the label then presents under /dev, and
you must mount using the label device under /dev somewhere. Otherwise you
risk having the metadata at the end of the partition get overwritten. The
partition exported by the label device prevents this.

Which means you can have a GPT partition label, a glabel for the partition,
and then a UFS filesystem mounted under the glabel device with a UFS label.

But that's a lot of labels and is just asking for trouble. Really, don't
do that. Just don't.

If you stick with GPT labels then you won't have these problems. If you
have to mess with UFS labels or some other label scheme then be very careful
to not create a mess for yourself.

I do not know if zfs or zfsd know about glabel devices. I can image them
accidentally picking up the device node for the disk partition and blowing
away a glabel. And the results are probably not good if ZFS sees a disk
that happens to have a glabel on it. The glabel device node probably won't
be picked up and the result would be ZFS blowing away the glabel. This is
not an issue with GPT partition labels.

-- 
Kevin P. Neal                                http://www.pobox.com/~kpn/

                    "A pig's gotta fly." - Crimson Pig



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ZDjMtdD9vu_QRdS2>