Manual Page Search Parameters

GLABEL(8) System Manager's Manual GLABEL(8)

glabeldisk labelization control utility

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

The glabel utility is used for GEOM provider labelization. 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.

This GEOM class also provides volume label detection for file systems. Those labels cannot be set with glabel, but must be set with the appropriate file system utility, e.g. for UFS the file system label is set with tunefs(8). Currently supported file systems are:

Support for partition metadata is implemented for:

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

Generic labels created and managed solely by glabel are created 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 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. 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.

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 file system on the device is currently mounted. To ensure that 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.

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

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.
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.
Turn off the given label by its name. This command does not touch on-disk metadata!
Same as stop.
Clear metadata on the given devices.
Dump metadata stored on the given devices.
Refresh / rediscover metadata from the given devices.
See geom(8).
See geom(8).
See geom(8).
See geom(8).

Additional options:

Force the removal of the specified labels.
Be more verbose.

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 is 0 on success, and 1 if the command fails.

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

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

The glabel utility appeared in FreeBSD 5.3.

Pawel Jakub Dawidek <pjd@FreeBSD.org>

April 19, 2024 dev