GLABEL(8)
π 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,glabelreserves the last sector of the device to store the label information. if the device already contains a file system,glabelwill 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 modulegeom_label.kowill 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 modulegeom_label.kowill 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 asstop.clearβ Clear metadata on the given devices.dumpβ Dump metadata stored on the given devices.refreshβ Refresh / rediscover metadata from the given devices.listβ Seegeom(8).statusβ Seegeom(8).loadβ Seegeom(8).unloadβ Seegeom(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
- Copyright (c) 2004-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms