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