Re: filesystem labels?

From: Polytropon <freebsd_at_edvax.de>
Date: Thu, 13 Apr 2023 09:17:08 UTC
On Wed, 12 Apr 2023 08:58:22 -0700, Dan Mahoney (Ports) wrote:
> I find that the handbook mentions glabel labels, but several
> other places say don’t use them.

For example?

THis is a honest question, because in my experience glabels
are a common solution for disk labelling.



> 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 are specific to GPT partitioning scheme (as
opposed to MBR partitioning, either as "dedicated mode"
with bare partitions, or "DOS mode" with partitions
inide slices). Because today you're probably going to
use GPT partitioning, GPT labels can be used without
any problem. Labels applied to MBR-style partitions
can be both glabel or UFSIDs.



> I’ve seen some more complete posts on the forums
> (i.e. https://forums.freebsd.org/threads/how-to-label-partitions.64380/)
> but they still don’t show the full picture of what
> labels are usable where, by what and which.

Allow me to try to help with this problem:

GPT partitioning:
	devices: /dev/da0p1, /dev/da0p2, ...
	tool: gpart
	label: GPT label
	location: /dev/gpt/
MBR partitioning:
	tools: gpart (traditional: fdisk, disklabel)
	dedicated partitioning:
		devices: /dev/da0a, /dev/da0b, ...
		tool: glabel
		label: glabel
		location: /dev/label/
		applied to FS (instead of partition):
			tools: newfs, tunefs
			label: UFS label
			location: /dev/ufs/
			-or-
			tool: none
			label: UFSID
			location: /dev/ufsid/
	DOS style ("primary DOS partitions"):
		devices: /dev/da0s1a, da0s1b, ... /dev/da1s1a, ...
		tools and labels as above

My very own summary is: When you setup disks, use GPT.
Use MBR only if you have a good reason to. :-)

Of course you _can_ apply a UFS label or use a UFSID
for a UFS filesystem in a GPT partition, but that's
not really neccessary because you can already label
the partition itself.



> Is there a good primer people know of of what the various
> types are, fully, which are supported in fstab, which work
> with ZFS only, and the like?

Not that I'm aware of, but please compare:

https://docs.freebsd.org/en/books/handbook/geom/#geom-glabel

https://people.freebsd.org/~rodrigc/doc/data/doc/en_US.ISO8859-1/books/handbook/bsdinstall-partitioning.html

http://wonkity.com/~wblock/docs/html/disksetup.html



> Or should I just keep on using /dev/daX in fstab?

Nothing wrong with that in a static environment, i. e.,
one where you can safely predict which devices wiill be
detected in which order to conclude what their device
filenames will be. Otherwise, go with GPT labels.



> (This only came up, as I’m moving virtual disk images
> around, and renumbering happens automatically when I
> delete one from a running vm), so labels are useful
> in this case.

Definitely.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...