xref: /freebsd/lib/geom/virstor/gvirstor.8 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1*e4b0a90eSBrooks Davis.\" Copyright (c) 2006-2011 Ivan Voras <ivoras@FreeBSD.org>
2*e4b0a90eSBrooks Davis.\" All rights reserved.
3*e4b0a90eSBrooks Davis.\"
4*e4b0a90eSBrooks Davis.\" Redistribution and use in source and binary forms, with or without
5*e4b0a90eSBrooks Davis.\" modification, are permitted provided that the following conditions
6*e4b0a90eSBrooks Davis.\" are met:
7*e4b0a90eSBrooks Davis.\" 1. Redistributions of source code must retain the above copyright
8*e4b0a90eSBrooks Davis.\"    notice, this list of conditions and the following disclaimer.
9*e4b0a90eSBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright
10*e4b0a90eSBrooks Davis.\"    notice, this list of conditions and the following disclaimer in the
11*e4b0a90eSBrooks Davis.\"    documentation and/or other materials provided with the distribution.
12*e4b0a90eSBrooks Davis.\"
13*e4b0a90eSBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
14*e4b0a90eSBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15*e4b0a90eSBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16*e4b0a90eSBrooks Davis.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
17*e4b0a90eSBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18*e4b0a90eSBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19*e4b0a90eSBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20*e4b0a90eSBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21*e4b0a90eSBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22*e4b0a90eSBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23*e4b0a90eSBrooks Davis.\" SUCH DAMAGE.
24*e4b0a90eSBrooks Davis.\"
25*e4b0a90eSBrooks Davis.Dd October 1, 2013
26*e4b0a90eSBrooks Davis.Dt GVIRSTOR 8
27*e4b0a90eSBrooks Davis.Os
28*e4b0a90eSBrooks Davis.Sh NAME
29*e4b0a90eSBrooks Davis.Nm gvirstor
30*e4b0a90eSBrooks Davis.Nd "control utility for virtual data storage devices"
31*e4b0a90eSBrooks Davis.Sh SYNOPSIS
32*e4b0a90eSBrooks Davis.Nm
33*e4b0a90eSBrooks Davis.Cm label
34*e4b0a90eSBrooks Davis.Op Fl hv
35*e4b0a90eSBrooks Davis.Op Fl s Ar virsize
36*e4b0a90eSBrooks Davis.Op Fl m Ar chunksize
37*e4b0a90eSBrooks Davis.Ar name
38*e4b0a90eSBrooks Davis.Ar prov ...
39*e4b0a90eSBrooks Davis.Nm
40*e4b0a90eSBrooks Davis.Cm stop
41*e4b0a90eSBrooks Davis.Op Fl fv
42*e4b0a90eSBrooks Davis.Ar name ...
43*e4b0a90eSBrooks Davis.Nm
44*e4b0a90eSBrooks Davis.Cm destroy
45*e4b0a90eSBrooks Davis.Op Fl fv
46*e4b0a90eSBrooks Davis.Ar name ...
47*e4b0a90eSBrooks Davis.Nm
48*e4b0a90eSBrooks Davis.Cm add
49*e4b0a90eSBrooks Davis.Op Fl vh
50*e4b0a90eSBrooks Davis.Ar name prov ...
51*e4b0a90eSBrooks Davis.Nm
52*e4b0a90eSBrooks Davis.Cm remove
53*e4b0a90eSBrooks Davis.Op Fl v
54*e4b0a90eSBrooks Davis.Ar name prov ...
55*e4b0a90eSBrooks Davis.Nm
56*e4b0a90eSBrooks Davis.Cm clear
57*e4b0a90eSBrooks Davis.Op Fl v
58*e4b0a90eSBrooks Davis.Ar prov ...
59*e4b0a90eSBrooks Davis.Nm
60*e4b0a90eSBrooks Davis.Cm dump
61*e4b0a90eSBrooks Davis.Ar prov ...
62*e4b0a90eSBrooks Davis.Nm
63*e4b0a90eSBrooks Davis.Cm list
64*e4b0a90eSBrooks Davis.Nm
65*e4b0a90eSBrooks Davis.Cm status
66*e4b0a90eSBrooks Davis.Nm
67*e4b0a90eSBrooks Davis.Cm load
68*e4b0a90eSBrooks Davis.Nm
69*e4b0a90eSBrooks Davis.Cm unload
70*e4b0a90eSBrooks Davis.Sh DESCRIPTION
71*e4b0a90eSBrooks DavisThe
72*e4b0a90eSBrooks Davis.Nm
73*e4b0a90eSBrooks Davisutility is used for setting up a virtual storage device of arbitrary
74*e4b0a90eSBrooks Davislarge size
75*e4b0a90eSBrooks Davis.Pq for example, several TB ,
76*e4b0a90eSBrooks Davisconsisting of an arbitrary number of physical storage devices with the
77*e4b0a90eSBrooks Davistotal size which is equal to or smaller than the virtual size.
78*e4b0a90eSBrooks DavisData for the virtual devices will be allocated from physical devices on
79*e4b0a90eSBrooks Davisdemand.
80*e4b0a90eSBrooks DavisThe idea behind
81*e4b0a90eSBrooks Davis.Nm
82*e4b0a90eSBrooks Davisis similar to the concept of Virtual Memory in operating systems,
83*e4b0a90eSBrooks Daviseffectively allowing users to overcommit on storage
84*e4b0a90eSBrooks Davis.Pq free file system space .
85*e4b0a90eSBrooks DavisThe concept is also known as "thin provisioning" in virtualization
86*e4b0a90eSBrooks Davisenvironments, only here it is implemented on the level of physical storage
87*e4b0a90eSBrooks Davisdevices.
88*e4b0a90eSBrooks Davis.Pp
89*e4b0a90eSBrooks DavisThe first argument to
90*e4b0a90eSBrooks Davis.Nm
91*e4b0a90eSBrooks Davisindicates an action to be performed:
92*e4b0a90eSBrooks Davis.Bl -tag -width ".Cm remove"
93*e4b0a90eSBrooks Davis.It Cm label
94*e4b0a90eSBrooks DavisSet up a virtual device from the given components with the specified
95*e4b0a90eSBrooks Davis.Ar name .
96*e4b0a90eSBrooks DavisMetadata is stored in the last sector of every component.
97*e4b0a90eSBrooks DavisArgument
98*e4b0a90eSBrooks Davis.Fl s Ar virsize
99*e4b0a90eSBrooks Davisis the size of new virtual device, with default being set to 2 TiB
100*e4b0a90eSBrooks Davis.Pq 2097152 MiB .
101*e4b0a90eSBrooks DavisArgument
102*e4b0a90eSBrooks Davis.Fl m Ar chunksize
103*e4b0a90eSBrooks Davisis the chunk size, with default being set to 4 MiB
104*e4b0a90eSBrooks Davis.Pq 4096 KiB .
105*e4b0a90eSBrooks DavisThe default arguments are thus
106*e4b0a90eSBrooks Davis.Qq Fl s Ar 2097152 Fl m Ar 4096 .
107*e4b0a90eSBrooks Davis.It Cm stop
108*e4b0a90eSBrooks DavisTurn off an existing virtual device with the given
109*e4b0a90eSBrooks Davis.Ar name .
110*e4b0a90eSBrooks DavisThis command does not touch on-disk metadata.
111*e4b0a90eSBrooks DavisAs with other GEOM classes, stopped geoms cannot be started manually.
112*e4b0a90eSBrooks Davis.It Cm destroy
113*e4b0a90eSBrooks DavisSame as
114*e4b0a90eSBrooks Davis.Cm stop.
115*e4b0a90eSBrooks Davis.It Cm add
116*e4b0a90eSBrooks DavisAdds new components to existing virtual device with the given
117*e4b0a90eSBrooks Davis.Ar name .
118*e4b0a90eSBrooks DavisThe specified virstor device must exist and be active
119*e4b0a90eSBrooks Davis.Pq i.e. module loaded, device present in Pa /dev .
120*e4b0a90eSBrooks DavisThis action can be safely performed while the virstor device is in use
121*e4b0a90eSBrooks Davis.Pq Qo hot Qc operation .
122*e4b0a90eSBrooks Davis.It Cm remove
123*e4b0a90eSBrooks DavisRemoves components from existing virtual device with the given
124*e4b0a90eSBrooks Davis.Ar name .
125*e4b0a90eSBrooks DavisOnly unallocated providers can be removed.
126*e4b0a90eSBrooks Davis.It Cm clear
127*e4b0a90eSBrooks DavisClear metadata on the given providers.
128*e4b0a90eSBrooks Davis.It Cm dump
129*e4b0a90eSBrooks DavisDump metadata stored on the given providers.
130*e4b0a90eSBrooks Davis.It Cm list
131*e4b0a90eSBrooks DavisSee
132*e4b0a90eSBrooks Davis.Xr geom 8 .
133*e4b0a90eSBrooks Davis.It Cm status
134*e4b0a90eSBrooks DavisSee
135*e4b0a90eSBrooks Davis.Xr geom 8 .
136*e4b0a90eSBrooks Davis.It Cm load
137*e4b0a90eSBrooks DavisSee
138*e4b0a90eSBrooks Davis.Xr geom 8 .
139*e4b0a90eSBrooks Davis.It Cm unload
140*e4b0a90eSBrooks DavisSee
141*e4b0a90eSBrooks Davis.Xr geom 8 .
142*e4b0a90eSBrooks Davis.El
143*e4b0a90eSBrooks Davis.Pp
144*e4b0a90eSBrooks DavisAdditional options:
145*e4b0a90eSBrooks Davis.Bl -tag -width ".Fl f"
146*e4b0a90eSBrooks Davis.It Fl f
147*e4b0a90eSBrooks DavisForce the removal of the specified virtual device.
148*e4b0a90eSBrooks Davis.It Fl h
149*e4b0a90eSBrooks DavisHardcode providers' names in metadata.
150*e4b0a90eSBrooks Davis.It Fl v
151*e4b0a90eSBrooks DavisBe more verbose.
152*e4b0a90eSBrooks Davis.El
153*e4b0a90eSBrooks Davis.Sh EXAMPLES
154*e4b0a90eSBrooks DavisThe following example shows how to create a virtual device of default size
155*e4b0a90eSBrooks Davis.Pq 2 TiB ,
156*e4b0a90eSBrooks Davisof default chunk
157*e4b0a90eSBrooks Davis.Pq extent
158*e4b0a90eSBrooks Davissize
159*e4b0a90eSBrooks Davis.Pq 4 MiB ,
160*e4b0a90eSBrooks Daviswith two physical devices for backing storage.
161*e4b0a90eSBrooks Davis.Bd -literal -offset indent
162*e4b0a90eSBrooks Davis.No gvirstor label -v Ar mydata Ar /dev/ada4 Ar /dev/ada6
163*e4b0a90eSBrooks Davis.No newfs Ar /dev/virstor/mydata
164*e4b0a90eSBrooks Davis.Ed
165*e4b0a90eSBrooks Davis.Pp
166*e4b0a90eSBrooks DavisFrom now on, the virtual device will be available via the
167*e4b0a90eSBrooks Davis.Pa /dev/virstor/mydata
168*e4b0a90eSBrooks Davisdevice entry.
169*e4b0a90eSBrooks DavisTo add a new physical device / component to an active virstor device:
170*e4b0a90eSBrooks Davis.Bd -literal -offset indent
171*e4b0a90eSBrooks Davis.No gvirstor add Ar mydata Ar ada8
172*e4b0a90eSBrooks Davis.Ed
173*e4b0a90eSBrooks Davis.Pp
174*e4b0a90eSBrooks DavisThis will add physical storage of
175*e4b0a90eSBrooks Davis.Ar ada8
176*e4b0a90eSBrooks Davisto
177*e4b0a90eSBrooks Davis.Pa /dev/virstor/mydata
178*e4b0a90eSBrooks Davisdevice.
179*e4b0a90eSBrooks Davis.Pp
180*e4b0a90eSBrooks DavisTo see the device status information
181*e4b0a90eSBrooks Davis.Pq including how much physical storage is still available for the virtual device ,
182*e4b0a90eSBrooks Davisuse:
183*e4b0a90eSBrooks Davis.Bd -literal -offset indent
184*e4b0a90eSBrooks Davisgvirstor list
185*e4b0a90eSBrooks Davis.Ed
186*e4b0a90eSBrooks Davis.Pp
187*e4b0a90eSBrooks DavisAll standard
188*e4b0a90eSBrooks Davis.Xr geom 8
189*e4b0a90eSBrooks Davissubcommands
190*e4b0a90eSBrooks Davis.Pq e.g. Cm status , Cm help
191*e4b0a90eSBrooks Davisare also supported.
192*e4b0a90eSBrooks Davis.Sh SYSCTL VARIABLES
193*e4b0a90eSBrooks Davis.Nm
194*e4b0a90eSBrooks Davishas several
195*e4b0a90eSBrooks Davis.Xr sysctl 8
196*e4b0a90eSBrooks Davistunable variables.
197*e4b0a90eSBrooks Davis.Bd -literal -offset indent
198*e4b0a90eSBrooks Davis.Va int kern.geom.virstor.debug
199*e4b0a90eSBrooks Davis.Ed
200*e4b0a90eSBrooks Davis.Pp
201*e4b0a90eSBrooks DavisThis sysctl controls verbosity of the kernel module, in the range
202*e4b0a90eSBrooks Davis1 to 15.
203*e4b0a90eSBrooks DavisMessages that are marked with higher verbosity levels than this are
204*e4b0a90eSBrooks Davissuppressed.
205*e4b0a90eSBrooks DavisDefault value is 5 and it is not recommended to set this tunable to less
206*e4b0a90eSBrooks Davisthan 2, because level 1 messages are error events, and level 2 messages
207*e4b0a90eSBrooks Davisare system warnings.
208*e4b0a90eSBrooks Davis.Bd -literal -offset indent
209*e4b0a90eSBrooks Davis.Va int kern.geom.virstor.chunk_watermark
210*e4b0a90eSBrooks Davis.Ed
211*e4b0a90eSBrooks Davis.Pp
212*e4b0a90eSBrooks DavisValue in this sysctl sets warning watermark level for physical chunk
213*e4b0a90eSBrooks Davisusage on a single component.
214*e4b0a90eSBrooks DavisThe warning is issued when a virstor component has less than this many
215*e4b0a90eSBrooks Davisfree chunks
216*e4b0a90eSBrooks Davis.Pq default 100 .
217*e4b0a90eSBrooks Davis.Bd -literal -offset indent
218*e4b0a90eSBrooks Davis.Va int kern.geom.virstor.component_watermark
219*e4b0a90eSBrooks Davis.Ed
220*e4b0a90eSBrooks Davis.Pp
221*e4b0a90eSBrooks DavisValue in this sysctl sets warning watermark level for component usage.
222*e4b0a90eSBrooks DavisThe warning is issued when there are less than this many unallocated
223*e4b0a90eSBrooks Daviscomponents
224*e4b0a90eSBrooks Davis.Pq default is 1 .
225*e4b0a90eSBrooks Davis.Pp
226*e4b0a90eSBrooks DavisAll these sysctls are also available as
227*e4b0a90eSBrooks Davis.Xr loader 8
228*e4b0a90eSBrooks Davistunables.
229*e4b0a90eSBrooks Davis.Sh DIAGNOSTICS
230*e4b0a90eSBrooks Davis.Ex -std
231*e4b0a90eSBrooks Davis.Pp
232*e4b0a90eSBrooks Davis.Nm
233*e4b0a90eSBrooks Daviskernel module issues log messages with prefixes in standardized format,
234*e4b0a90eSBrooks Daviswhich is useful for log message filtering and dispatching.
235*e4b0a90eSBrooks DavisEach message line begins with
236*e4b0a90eSBrooks Davis.Bd -literal -offset indent
237*e4b0a90eSBrooks Davis.Li GEOM_VIRSTOR[%d]:
238*e4b0a90eSBrooks Davis.Ed
239*e4b0a90eSBrooks Davis.Pp
240*e4b0a90eSBrooks DavisThe number
241*e4b0a90eSBrooks Davis.Pq %d
242*e4b0a90eSBrooks Davisis message verbosity / importance level, in the range 1 to 15.
243*e4b0a90eSBrooks DavisIf a message filtering, dispatching or operator alert system is used, it
244*e4b0a90eSBrooks Davisis recommended that messages with levels 1 and 2 be taken seriously
245*e4b0a90eSBrooks Davis.Pq for example, to catch out-of-space conditions as set by watermark
246*e4b0a90eSBrooks Davissysctls.
247*e4b0a90eSBrooks Davis.Sh SEE ALSO
248*e4b0a90eSBrooks Davis.Xr geom 4 ,
249*e4b0a90eSBrooks Davis.Xr fstab 5 ,
250*e4b0a90eSBrooks Davis.Xr geom 8 ,
251*e4b0a90eSBrooks Davis.Xr glabel 8 ,
252*e4b0a90eSBrooks Davis.Xr newfs 8
253*e4b0a90eSBrooks Davis.Sh HISTORY
254*e4b0a90eSBrooks DavisThe
255*e4b0a90eSBrooks Davis.Nm
256*e4b0a90eSBrooks Davisutility first appeared in
257*e4b0a90eSBrooks Davis.Fx 7.0 .
258*e4b0a90eSBrooks Davis.Sh AUTHORS
259*e4b0a90eSBrooks Davis.An Ivan Voras Aq Mt ivoras@FreeBSD.org
260*e4b0a90eSBrooks Davis.Pp
261*e4b0a90eSBrooks DavisSponsored by Google Summer of Code 2006.
262*e4b0a90eSBrooks Davis.Sh BUGS
263*e4b0a90eSBrooks DavisCommands
264*e4b0a90eSBrooks Davis.Cm add
265*e4b0a90eSBrooks Davisand
266*e4b0a90eSBrooks Davis.Cm remove
267*e4b0a90eSBrooks Daviscontain unavoidable critical sections which may make the virstor
268*e4b0a90eSBrooks Davisdevice unusable if a power failure
269*e4b0a90eSBrooks Davis.Pq or other disruptive event
270*e4b0a90eSBrooks Davishappens during their execution.
271*e4b0a90eSBrooks DavisIt is recommended to run them when the system is quiescent.
272*e4b0a90eSBrooks Davis.Sh ASSUMPTIONS AND INTERACTION WITH FILE SYSTEMS
273*e4b0a90eSBrooks DavisThere are several assumptions that
274*e4b0a90eSBrooks Davis.Nm
275*e4b0a90eSBrooks Davishas in its operation: that the size of the virtual storage device will not
276*e4b0a90eSBrooks Davischange once it is set, and that the sizes of individual physical storage
277*e4b0a90eSBrooks Daviscomponents will always remain constant during their existence.
278*e4b0a90eSBrooks DavisFor alternative ways to implement virtual or resizable file systems see
279*e4b0a90eSBrooks Davis.Xr zfs 1M ,
280*e4b0a90eSBrooks Davis.Xr gconcat 8
281*e4b0a90eSBrooks Davisand
282*e4b0a90eSBrooks Davis.Xr growfs 8 .
283*e4b0a90eSBrooks Davis.Pp
284*e4b0a90eSBrooks DavisNote that
285*e4b0a90eSBrooks Davis.Nm
286*e4b0a90eSBrooks Davishas nontrivial interaction with file systems which initialize a large
287*e4b0a90eSBrooks Davisnumber of on-disk structures during newfs.
288*e4b0a90eSBrooks DavisIf such file systems attempt to spread their structures across the drive
289*e4b0a90eSBrooks Davismedia
290*e4b0a90eSBrooks Davis.Pq like UFS/UFS2 does ,
291*e4b0a90eSBrooks Davistheir efforts will be effectively foiled by sequential allocation of
292*e4b0a90eSBrooks Davischunks in
293*e4b0a90eSBrooks Davis.Nm
294*e4b0a90eSBrooks Davisand all their structures will be physically allocated at the start
295*e4b0a90eSBrooks Davisof the first virstor component.
296*e4b0a90eSBrooks DavisThis could have a significant impact on file system performance
297*e4b0a90eSBrooks Davis.Pq which can in some rare cases be even positive .
298