GLABEL(8)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’… GLABEL(8) β€” the disk labelization control utility, bestie edition

okay so real talk: glabel is from the System Manager's Manual, and it's the tool that gives your GEOM providers names. Labels. Little name tags for your disks, so you don't have to remember that /dev/da2 is your /usr at 3am. iconic behaviour honestly πŸŽ€


✨ SYNOPSIS ✨

glabel create [-v] name dev
glabel destroy [-fv] name ...
glabel label [-v] name dev
glabel stop [-fv] name ...
glabel clear [-v] dev ...
glabel dump dev ...
glabel refresh dev ...
glabel list
glabel status
glabel load
glabel unload

🌸 DESCRIPTION 🌸

So glabel is the whole utility for GEOM provider labelization β€” aka putting labels on GEOM providers. And there are exactly two ways to do it, and you will be picking one:

  • β€œmanual” β€” no metadata gets stored on the device at all. So you gotta configure the label by hand every single time you need it. highkey annoying but valid.
  • β€œautomatic” β€” uses on-disk metadata to store the label and detect it automatically in the future. the way that it just remembers for you 😌

This GEOM class also does volume label detection for file systems. important distinction tho: those labels cannot be set with glabel β€” you have to set them with the appropriate file system utility. like, for UFS the file system label gets set with tunefs(8). currently supported file systems are:

  • UFS1 volume names (directory /dev/ufs/).
  • UFS2 volume names (directory /dev/ufs/).
  • UFS1 file system IDs (directory /dev/ufsid/).
  • UFS2 file system IDs (directory /dev/ufsid/).
  • MSDOSFS (FAT12, FAT16, FAT32) (directory /dev/msdosfs/).
  • CD ISO9660 (directory /dev/iso9660/).
  • EXT2FS (directory /dev/ext2fs/).
  • NTFS (directory /dev/ntfs/).
  • Swap Linux (directory /dev/swaplinux/).

Support for partition metadata is implemented for:

  • GPT labels (directory /dev/gpt/).
  • GPT UUIDs (directory /dev/gptid/).

Generic disk ID strings get exported as labels in the format /dev/diskid/GEOM_CLASS-ident e.g. /dev/diskid/DISK-6QG3Z026.

Generic labels that are created and managed solely by glabel live in the /dev/label/ directory. 🏠

⚠️ bestie listen to me: generic, automatic labels occupy some space on the device and thus should not be added to a device already containing a file system. in particular, glabel reserves the last sector of the device to store the label information. if the device already contains a file system, glabel will overwrite the last sector, possibly damaging the file system, and the file system may later overwrite the label sector. it's giving mutual destruction πŸ’€

Instead: create a label before initializing the file system, and initialize that file system on the device created by glabel under the /dev/label/ directory. then the file system will correctly account for the space occupied by the generic label, since the glabel device will be one sector smaller than the device from which it was created. slay, math.

Also note that for all label types, nested GEOM classes will cause additional device nodes to be created, with context-specific data appended to their names. e.g. for every node like /dev/label/bigdisk there will be additional entries for any partitions which the device contains, like /dev/label/bigdiskp1 and /dev/label/bigdiskp1a. it's giving family tree 🌳

glabel requires write access to a device to create, modify, and destroy "automatic" labels. and it will fail to persist changes if they are applied while a file system on the device is currently mounted. to ensure modifications are stored across a reboot, the file system needs to be unmounted first. if the device holds the system's root file system, entering into single user mode and mounting in read-only mode is required to persist the change. no shortcuts, periodt.

The first argument to glabel indicates an action to be performed:

  • create β€” Create temporary label name for the given provider. this is the β€œmanual” method ✍️. the kernel module geom_label.ko will be loaded if it is not loaded already.
  • label β€” Set up a label name for the given provider. this is the β€œautomatic” method, where metadata is stored in a provider's last sector. the kernel module geom_label.ko will be loaded if it is not loaded already.
  • stop β€” Turn off the given label by its name. this command does not touch on-disk metadata! πŸ™ˆ
  • destroy β€” Same as stop.
  • clear β€” Clear metadata on the given devices.
  • dump β€” Dump metadata stored on the given devices.
  • refresh β€” Refresh / rediscover metadata from the given devices.
  • list β€” See geom(8).
  • status β€” See geom(8).
  • load β€” See geom(8).
  • unload β€” See geom(8).

Additional options:

  • -f β€” Force the removal of the specified labels. πŸ’ͺ
  • -v β€” Be more verbose. (she's chatty and we love her)

πŸ¦‹ SYSCTL VARIABLES πŸ¦‹

The following sysctl(8) variables can be used to control the behavior of the LABEL GEOM class. the default value is shown next to each variable. default value girlies rise 🫢

kern.geom.label.debug: 0

Debug level of the LABEL GEOM class. this can be set to a number between 0 and 2 inclusive. if set to 0 minimal debug information is printed, and if set to 2 the maximum amount of debug information is printed. so like, 2 is maximum yapping mode πŸ”₯

kern.geom.label.*.enable: 1

Most LABEL providers implement a sysctl(8) flag and a tunable variable named in the above format. this flag controls if the label provider will be active, tasting devices and creating label nodes in the devfs(4) tree. it is sometimes desirable to disable certain label types if they conflict with other classes in complex GEOM topologies. lowkey the peacekeeping setting ✨


πŸ’€ EXIT STATUS πŸ’€

Exit status is 0 on success, and 1 if the command fails. that's it, that's the whole vibe check.


🌈 EXAMPLES 🌈

The following example shows how to set up a label for disk β€œda2”, create a file system on it, and mount it:

glabel label -v usr /dev/da2
newfs /dev/label/usr
mount /dev/label/usr /usr
[...]
umount /usr
glabel stop usr
glabel unload

The next example shows how to set up a label for a UFS file system:

tunefs -L data /dev/da4s1a
mount /dev/ufs/data /mnt/data

πŸ‘‘ SEE ALSO πŸ‘‘

geom(4), loader.conf(5), geom(8), mount(8), newfs(8), sysctl(8), tunefs(8), umount(8)


🧚 HISTORY 🧚

The glabel utility appeared in FreeBSD 5.3. she's vintage, she's iconic πŸ’œ


πŸ’– AUTHORS πŸ’–

Pawel Jakub Dawidek <pjd@FreeBSD.org> β€” thank you for your service, king 🫑


okay that's the whole page, you ate that ⭐ β€” this cutie was served up on the Debian side of things, dated April 19, 2024, and remember bestie: label first, newfs second, always πŸ’…πŸŽ€

πŸ“¦ where this page comes from
  • freebsd 15.1: base 15.1
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms