xref: /freebsd/lib/geom/label/glabel.8 (revision 19fae0f66023a97a9b464b3beeeabb2081f575b3)
1.\" Copyright (c) 2004-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd March 12, 2017
28.Dt GLABEL 8
29.Os
30.Sh NAME
31.Nm glabel
32.Nd "disk labelization control utility"
33.Sh SYNOPSIS
34.Nm
35.Cm create
36.Op Fl v
37.Ar name
38.Ar dev
39.Nm
40.Cm destroy
41.Op Fl fv
42.Ar name ...
43.Nm
44.Cm label
45.Op Fl v
46.Ar name
47.Ar dev
48.Nm
49.Cm stop
50.Op Fl fv
51.Ar name ...
52.Nm
53.Cm clear
54.Op Fl v
55.Ar dev ...
56.Nm
57.Cm dump
58.Ar dev ...
59.Nm
60.Cm refresh
61.Ar dev ...
62.Nm
63.Cm list
64.Nm
65.Cm status
66.Nm
67.Cm load
68.Nm
69.Cm unload
70.Sh DESCRIPTION
71The
72.Nm
73utility is used for GEOM provider labelization.
74A label can be set up on a GEOM provider in two ways:
75.Dq manual
76or
77.Dq automatic .
78When using the
79.Dq manual
80method, no metadata are stored on the devices, so a label has to be configured
81by hand every time it is needed.
82The
83.Dq automatic
84method uses on-disk metadata to store the label and detect it automatically in
85the future.
86.Pp
87This GEOM class also provides volume label detection for file systems.
88Those labels cannot be set with
89.Nm ,
90but must be set with the appropriate file system utility, e.g.\& for UFS
91the file system label is set with
92.Xr tunefs 8 .
93Currently supported file systems are:
94.Pp
95.Bl -bullet -offset indent -compact
96.It
97UFS1 volume names (directory
98.Pa /dev/ufs/ ) .
99.It
100UFS2 volume names (directory
101.Pa /dev/ufs/ ) .
102.It
103UFS1 file system IDs (directory
104.Pa /dev/ufsid/ ) .
105.It
106UFS2 file system IDs (directory
107.Pa /dev/ufsid/ ) .
108.It
109MSDOSFS (FAT12, FAT16, FAT32) (directory
110.Pa /dev/msdosfs/ ) .
111.It
112CD ISO9660 (directory
113.Pa /dev/iso9660/ ) .
114.It
115EXT2FS (directory
116.Pa /dev/ext2fs/ ) .
117.It
118REISERFS (directory
119.Pa /dev/reiserfs/ ) .
120.It
121NTFS (directory
122.Pa /dev/ntfs/ ) .
123.El
124.Pp
125Support for partition metadata is implemented for:
126.Pp
127.Bl -bullet -offset indent -compact
128.It
129GPT labels (directory
130.Pa /dev/gpt/ ) .
131.It
132GPT UUIDs (directory
133.Pa /dev/gptid/ ) .
134.El
135.Pp
136Generic disk ID strings are exported as labels in the format
137.Pa /dev/diskid/GEOM_CLASS-ident
138e.g.
139.Pa /dev/diskid/DISK-6QG3Z026  .
140.Pp
141Generic labels created and managed solely by
142.Xr glabel 8
143are created in the
144.Pa /dev/label/
145directory.
146.Pp
147Note that for all label types, nested GEOM classes will cause additional
148device nodes to be created, with context-specific data appended to their
149names. E.g. for every node like
150.Pa /dev/label/bigdisk
151there will be additional entries for any partitions which the device
152contains, like
153.Pa /dev/label/bigdiskp1
154and
155.Pa /dev/label/bigdiskp1a .
156.Pp
157The first argument to
158.Nm
159indicates an action to be performed:
160.Bl -tag -width ".Cm destroy"
161.It Cm create
162Create temporary label
163.Ar name
164for the given provider.
165This is the
166.Dq manual
167method.
168The kernel module
169.Pa geom_label.ko
170will be loaded if it is not loaded already.
171.It Cm label
172Set up a label
173.Ar name
174for the given provider.
175This is the
176.Dq automatic
177method, where metadata is stored in a provider's last sector.
178The kernel module
179.Pa geom_label.ko
180will be loaded if it is not loaded already.
181.It Cm stop
182Turn off the given label by its
183.Ar name .
184This command does not touch on-disk metadata!
185.It Cm destroy
186Same as
187.Cm stop .
188.It Cm clear
189Clear metadata on the given devices.
190.It Cm dump
191Dump metadata stored on the given devices.
192.It Cm refresh
193Refresh / rediscover metadata from the given devices.
194.It Cm list
195See
196.Xr geom 8 .
197.It Cm status
198See
199.Xr geom 8 .
200.It Cm load
201See
202.Xr geom 8 .
203.It Cm unload
204See
205.Xr geom 8 .
206.El
207.Pp
208Additional options:
209.Bl -tag -width indent
210.It Fl f
211Force the removal of the specified labels.
212.It Fl v
213Be more verbose.
214.El
215.Sh SYSCTL VARIABLES
216The following
217.Xr sysctl 8
218variables can be used to control the behavior of the
219.Nm LABEL
220GEOM class.
221The default value is shown next to each variable.
222.Bl -tag -width indent
223.It Va kern.geom.label.debug : No 0
224Debug level of the
225.Nm LABEL
226GEOM class.
227This can be set to a number between 0 and 2 inclusive.
228If set to 0 minimal debug information is printed, and if set to 2 the
229maximum amount of debug information is printed.
230.El
231.Bl -tag -width indent
232.It Va kern.geom.label.*.enable : No 1
233Most
234.Nm LABEL
235providers implement a
236.Xr sysctl 8
237flag and a tunable variable named in the above format. This flag
238controls if the label provider will be active, tasting devices
239and creating label nodes in the
240.Xr devfs 5
241tree. It is sometimes desirable to disable certain label types if
242they conflict with other classes in complex GEOM topologies.
243.El
244.Sh EXIT STATUS
245Exit status is 0 on success, and 1 if the command fails.
246.Sh EXAMPLES
247The following example shows how to set up a label for disk
248.Dq Li da2 ,
249create a file system on it, and mount it:
250.Bd -literal -offset indent
251glabel label -v usr /dev/da2
252newfs /dev/label/usr
253mount /dev/label/usr /usr
254[...]
255umount /usr
256glabel stop usr
257glabel unload
258.Ed
259.Pp
260The next example shows how to set up a label for a UFS file system:
261.Bd -literal -offset indent
262tunefs -L data /dev/da4s1a
263mount /dev/ufs/data /mnt/data
264.Ed
265.Sh SEE ALSO
266.Xr geom 4 ,
267.Xr loader.conf 5 ,
268.Xr geom 8 ,
269.Xr mount 8 ,
270.Xr newfs 8 ,
271.Xr sysctl 8 ,
272.Xr tunefs 8 ,
273.Xr umount 8
274.Sh HISTORY
275The
276.Nm
277utility appeared in
278.Fx 5.3 .
279.Sh AUTHORS
280.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org
281