xref: /freebsd/lib/geom/virstor/gvirstor.8 (revision 4543ef516683042d46f3bd3bb8a4f3f746e00499)
1.\" Copyright (c) 2006-2011 Ivan Voras <ivoras@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 October 1, 2013
26.Dt GVIRSTOR 8
27.Os
28.Sh NAME
29.Nm gvirstor
30.Nd "control utility for virtual data storage devices"
31.Sh SYNOPSIS
32.Nm
33.Cm label
34.Op Fl hv
35.Op Fl s Ar virsize
36.Op Fl m Ar chunksize
37.Ar name
38.Ar prov ...
39.Nm
40.Cm stop
41.Op Fl fv
42.Ar name ...
43.Nm
44.Cm destroy
45.Op Fl fv
46.Ar name ...
47.Nm
48.Cm add
49.Op Fl vh
50.Ar name prov ...
51.Nm
52.Cm remove
53.Op Fl v
54.Ar name prov ...
55.Nm
56.Cm clear
57.Op Fl v
58.Ar prov ...
59.Nm
60.Cm dump
61.Ar prov ...
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 setting up a virtual storage device of arbitrary
74large size
75.Pq for example, several TB ,
76consisting of an arbitrary number of physical storage devices with the
77total size which is equal to or smaller than the virtual size.
78Data for the virtual devices will be allocated from physical devices on
79demand.
80The idea behind
81.Nm
82is similar to the concept of Virtual Memory in operating systems,
83effectively allowing users to overcommit on storage
84.Pq free file system space .
85The concept is also known as "thin provisioning" in virtualization
86environments, only here it is implemented on the level of physical storage
87devices.
88.Pp
89The first argument to
90.Nm
91indicates an action to be performed:
92.Bl -tag -width ".Cm remove"
93.It Cm label
94Set up a virtual device from the given components with the specified
95.Ar name .
96Metadata is stored in the last sector of every component.
97Argument
98.Fl s Ar virsize
99is the size of new virtual device, with default being set to 2 TiB
100.Pq 2097152 MiB .
101Argument
102.Fl m Ar chunksize
103is the chunk size, with default being set to 4 MiB
104.Pq 4096 KiB .
105The default arguments are thus
106.Qq Fl s Ar 2097152 Fl m Ar 4096 .
107.It Cm stop
108Turn off an existing virtual device with the given
109.Ar name .
110This command does not touch on-disk metadata.
111As with other GEOM classes, stopped geoms cannot be started manually.
112.It Cm destroy
113Same as
114.Cm stop.
115.It Cm add
116Adds new components to existing virtual device with the given
117.Ar name .
118The specified virstor device must exist and be active
119.Pq i.e. module loaded, device present in Pa /dev .
120This action can be safely performed while the virstor device is in use
121.Pq Qo hot Qc operation .
122.It Cm remove
123Removes components from existing virtual device with the given
124.Ar name .
125Only unallocated providers can be removed.
126.It Cm clear
127Clear metadata on the given providers.
128.It Cm dump
129Dump metadata stored on the given providers.
130.It Cm list
131See
132.Xr geom 8 .
133.It Cm status
134See
135.Xr geom 8 .
136.It Cm load
137See
138.Xr geom 8 .
139.It Cm unload
140See
141.Xr geom 8 .
142.El
143.Pp
144Additional options:
145.Bl -tag -width ".Fl f"
146.It Fl f
147Force the removal of the specified virtual device.
148.It Fl h
149Hardcode providers' names in metadata.
150.It Fl v
151Be more verbose.
152.El
153.Sh EXAMPLES
154The following example shows how to create a virtual device of default size
155.Pq 2 TiB ,
156of default chunk
157.Pq extent
158size
159.Pq 4 MiB ,
160with two physical devices for backing storage.
161.Bd -literal -offset indent
162.No gvirstor label -v Ar mydata Ar /dev/ada4 Ar /dev/ada6
163.No newfs Ar /dev/virstor/mydata
164.Ed
165.Pp
166From now on, the virtual device will be available via the
167.Pa /dev/virstor/mydata
168device entry.
169To add a new physical device / component to an active virstor device:
170.Bd -literal -offset indent
171.No gvirstor add Ar mydata Ar ada8
172.Ed
173.Pp
174This will add physical storage of
175.Ar ada8
176to
177.Pa /dev/virstor/mydata
178device.
179.Pp
180To see the device status information
181.Pq including how much physical storage is still available for the virtual device ,
182use:
183.Bd -literal -offset indent
184gvirstor list
185.Ed
186.Pp
187All standard
188.Xr geom 8
189subcommands
190.Pq e.g. Cm status , Cm help
191are also supported.
192.Sh SYSCTL VARIABLES
193.Nm
194has several
195.Xr sysctl 8
196tunable variables.
197.Bd -literal -offset indent
198.Va int kern.geom.virstor.debug
199.Ed
200.Pp
201This sysctl controls verbosity of the kernel module, in the range
2021 to 15.
203Messages that are marked with higher verbosity levels than this are
204suppressed.
205Default value is 5 and it is not recommended to set this tunable to less
206than 2, because level 1 messages are error events, and level 2 messages
207are system warnings.
208.Bd -literal -offset indent
209.Va int kern.geom.virstor.chunk_watermark
210.Ed
211.Pp
212Value in this sysctl sets warning watermark level for physical chunk
213usage on a single component.
214The warning is issued when a virstor component has less than this many
215free chunks
216.Pq default 100 .
217.Bd -literal -offset indent
218.Va int kern.geom.virstor.component_watermark
219.Ed
220.Pp
221Value in this sysctl sets warning watermark level for component usage.
222The warning is issued when there are less than this many unallocated
223components
224.Pq default is 1 .
225.Pp
226All these sysctls are also available as
227.Xr loader 8
228tunables.
229.Sh DIAGNOSTICS
230.Ex -std
231.Pp
232.Nm
233kernel module issues log messages with prefixes in standardized format,
234which is useful for log message filtering and dispatching.
235Each message line begins with
236.Bd -literal -offset indent
237.Li GEOM_VIRSTOR[%d]:
238.Ed
239.Pp
240The number
241.Pq %d
242is message verbosity / importance level, in the range 1 to 15.
243If a message filtering, dispatching or operator alert system is used, it
244is recommended that messages with levels 1 and 2 be taken seriously
245.Pq for example, to catch out-of-space conditions as set by watermark
246sysctls.
247.Sh SEE ALSO
248.Xr geom 4 ,
249.Xr fstab 5 ,
250.Xr geom 8 ,
251.Xr glabel 8 ,
252.Xr newfs 8
253.Sh HISTORY
254The
255.Nm
256utility first appeared in
257.Fx 7.0 .
258.Sh AUTHORS
259.An Ivan Voras Aq Mt ivoras@FreeBSD.org
260.Pp
261Sponsored by Google Summer of Code 2006.
262.Sh BUGS
263Commands
264.Cm add
265and
266.Cm remove
267contain unavoidable critical sections which may make the virstor
268device unusable if a power failure
269.Pq or other disruptive event
270happens during their execution.
271It is recommended to run them when the system is quiescent.
272.Sh ASSUMPTIONS AND INTERACTION WITH FILE SYSTEMS
273There are several assumptions that
274.Nm
275has in its operation: that the size of the virtual storage device will not
276change once it is set, and that the sizes of individual physical storage
277components will always remain constant during their existence.
278For alternative ways to implement virtual or resizable file systems see
279.Xr zfs 1M ,
280.Xr gconcat 8
281and
282.Xr growfs 8 .
283.Pp
284Note that
285.Nm
286has nontrivial interaction with file systems which initialize a large
287number of on-disk structures during newfs.
288If such file systems attempt to spread their structures across the drive
289media
290.Pq like UFS/UFS2 does ,
291their efforts will be effectively foiled by sequential allocation of
292chunks in
293.Nm
294and all their structures will be physically allocated at the start
295of the first virstor component.
296This could have a significant impact on file system performance
297.Pq which can in some rare cases be even positive .
298