Reference

glabel(8)

GEOM provider disk label utility

NAME

glabel – GEOM provider disk label utility

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 [--libxo] list

glabel [--libxo] status

glabel load

glabel unload

DESCRIPTION

The glabel utility is used for GEOM provider label management.

This manual page will discuss three types of labels. Generic GEOM labels set with glabel label, filesystem labels recognized by a specific GEOM provider, and device metadata identifiers (like GPT IDs or Linux Swap UUIDs).

A label can be set up on a GEOM provider in two ways: “manual” or “automatic”. When using the “manual” method, no metadata are stored on the devices, so a label has to be configured by hand every time it is needed. The “automatic” method uses on-disk metadata to store the label and detect it automatically in the future.

Note that filesystem labels (such as those for UFS or FAT) and GPT-based identifiers (such as GPT labels or GPT UUIDs) are not created by glabel but may appear alongside GEOM labels in /dev.

GEOM labels are set in the GEOM area of disk metadata. Volume labels for filesystems are set by the appropriate filesystem utility, often within the filesystem data. Device metadata identifiers are set during partitioning. All types of labels can be used at the same time, and will have appropriate entries under /dev.

If a GEOM provider is able to read and understand the filesystem label or device metadata identifier, a suitable entry will be created as shown below:

Filesystem TypeMount PathLabel Utility
FFS/UFS volume names/dev/ufs/tunefs(8)
FFS/UFS volume IDs/dev/ufsid/newfs(8)
FAT12/FAT16/FAT32/dev/msdosfs/newfs_msdosfs(8)
CD9660/dev/iso9660/makefs(8)
EXT2FS/dev/ext2fs/e2label(8)
Linux Swap/dev/swaplinux/mkswap(8)
GPT label/dev/gpt/gpart(8)
GPT UUIDs/dev/gptid/gpart(8)

Generic disk ID strings are exported as labels in the format /dev/diskid/GEOM_CLASS-ident e.g. /dev/diskid/DISK-6QG3Z026. These disk ID labels are not created by glabel, but may coexist with /dev/label/ labels.

Generic GEOM labels are created and managed solely by glabel. Volumes with GEOM labels are mounted in the /dev/label/ directory. Note that generic, automatic labels occupy some space on the device and thus should not be added to a device already containing a filesystem. In particular, glabel reserves the last sector of the device to store the label information. If the device already contains a filesystem, glabel will overwrite the last sector, possibly damaging the filesystem, and the filesystem may later overwrite the label sector. Instead, create a label before initializing the filesystem, and initialize that filesystem on the device created by glabel under the /dev/label/ directory. Then the filesystem 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.

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.

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

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 GEOM 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).

--libxo

Generate output via libxo(3) in a selection of different human and machine readable formats. See xo_options(7) for details on command line arguments.

Additional options:

-f

Force the removal of the specified labels.

-v

Be more verbose.

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.

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.

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.

EXIT STATUS

Exit status is 0 on success, and 1 if the command fails.

EXAMPLES

The following example shows how to set up a GEOM label for disk “ada2”, create a filesystem on it, and mount it:

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

To set the volume label for a UFS filesystem, use the -L option with tunefs(8).

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

To set the volume label for a FAT filesystem, use the -L option with newfs_msdos(8).

newfs_msdos -L MYLABEL /dev/ada0p1

The label allows the partition to be found at /dev/msdosfs/MYLABEL.

To set an ISO9660 volume label at filesystem creation time:

makefs -t cd9660 -o volid=MYDISC

SEE ALSO

geom(4), loader.conf(5), xo_options(7), e2label(8), geom(8), gpart(8), makefs(8), mkswap(8), mount(8), newfs(8), newfs_msdos(8), sysctl(8), tunefs(8), umount(8)

HISTORY

The glabel utility appeared in FreeBSD 5.3.

AUTHORS

Pawel Jakub Dawidek ⟨[email protected]⟩

History

--libxo since FreeBSD 16.0-CURRENT (2026-10-27).