xref: /freebsd/lib/geom/nop/gnop.8 (revision c6989859ae9388eeb46a24fe88f9b8d07101c710)
1.\" Copyright (c) 2004-2006 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 December 29, 2019
28.Dt GNOP 8
29.Os
30.Sh NAME
31.Nm gnop
32.Nd "control utility for NOP GEOM class"
33.Sh SYNOPSIS
34.Nm
35.Cm create
36.Op Fl v
37.Op Fl c Ar count_until_fail
38.Op Fl d Ar delaymsec
39.Op Fl e Ar error
40.Op Fl o Ar offset
41.Op Fl p Ar stripesize
42.Op Fl P Ar stripeoffset
43.Op Fl q Ar rdelayprob
44.Op Fl r Ar rfailprob
45.Op Fl s Ar size
46.Op Fl S Ar secsize
47.Op Fl w Ar wfailprob
48.Op Fl x Ar wdelayprob
49.Op Fl z Ar physpath
50.Op Fl Z Ar gnopname
51.Ar dev ...
52.Nm
53.Cm configure
54.Op Fl v
55.Op Fl c Ar count_until_fail
56.Op Fl d Ar delaymsec
57.Op Fl e Ar error
58.Op Fl q Ar rdelayprob
59.Op Fl r Ar rfailprob
60.Op Fl w Ar wfailprob
61.Op Fl x Ar wdelayprob
62.Ar prov ...
63.Nm
64.Cm destroy
65.Op Fl fv
66.Ar prov ...
67.Nm
68.Cm reset
69.Op Fl v
70.Ar prov ...
71.Nm
72.Cm list
73.Nm
74.Cm status
75.Nm
76.Cm load
77.Nm
78.Cm unload
79.Sh DESCRIPTION
80The
81.Nm
82utility is used for setting up transparent providers on existing ones.
83Its main purpose is testing other GEOM classes, as it allows forced provider
84removal and I/O error simulation with a given probability.
85It also gathers statistics on the number of read, write, delete,
86getattr, flush, and other requests, and the number of bytes read and written.
87.Nm
88can also be used as a good starting point for implementing new GEOM
89classes.
90.Pp
91The first argument to
92.Nm
93indicates an action to be performed:
94.Bl -tag -width ".Cm configure"
95.It Cm create
96Set up a transparent provider on the given devices.
97If the operation succeeds, the new provider should appear with name
98.Pa /dev/ Ns Ao Ar dev Ac Ns Pa .nop .
99The kernel module
100.Pa geom_nop.ko
101will be loaded if it is not loaded already.
102.It Cm configure
103Configure existing transparent provider.
104At the moment it is only used for changing failure probability.
105.It Cm destroy
106Turn off the given transparent providers.
107.It Cm reset
108Reset statistics for the given transparent providers.
109.It Cm list
110See
111.Xr geom 8 .
112.It Cm status
113See
114.Xr geom 8 .
115.It Cm load
116See
117.Xr geom 8 .
118.It Cm unload
119See
120.Xr geom 8 .
121.El
122.Pp
123Additional options:
124.Bl -tag -width "-c count_until_fail"
125.It Fl c Ar count_until_fail
126Specifies the number of I/O requests to allow before setting the read, write and
127delay failure probabilities.
128.It Fl d Ar delaymsec
129Specifies the delay of the requests in milliseconds.
130Note that requests will be delayed before they are sent to the backing device.
131.It Fl e Ar error
132Specifies the error number to return on failure.
133.It Fl f
134Force the removal of the specified provider.
135.It Fl o Ar offset
136Where to begin on the original provider.
137.It Fl p Ar stripesize
138Value of the stripesize property of the transparent provider.
139.It Fl P Ar stripeoffset
140Value of the stripeoffset property of the transparent provider.
141.It Fl q Ar rdelayprob
142Specifies read delay probability in percent.
143.It Fl r Ar rfailprob
144Specifies read failure probability in percent.
145.It Fl s Ar size
146Size of the transparent provider.
147.It Fl S Ar secsize
148Sector size of the transparent provider.
149.It Fl w Ar wfailprob
150Specifies write failure probability in percent.
151.It Fl v
152Be more verbose.
153.It Fl x Ar wdelayprob
154Specifies write delay probability in percent.
155.It Fl z Ar physpath
156Physical path of the transparent provider.
157.It Fl Z Ar gnopname
158The name of the new provider.
159The suffix
160.Dq .nop
161will be appended to the provider name.
162.El
163.Sh SYSCTL VARIABLES
164The following
165.Xr sysctl 8
166variables can be used to control the behavior of the
167.Nm NOP
168GEOM class.
169The default value is shown next to each variable.
170.Bl -tag -width indent
171.It Va kern.geom.nop.debug : No 0
172Debug level of the
173.Nm NOP
174GEOM class.
175This can be set to a number between 0 and 2 inclusive.
176If set to 0, minimal debug information is printed.
177If set to 1, basic debug information is logged along with the I/O requests
178that were returned as errors.
179If set to 2, the maximum amount of debug information is printed including
180all I/O requests.
181.El
182.Sh EXIT STATUS
183Exit status is 0 on success, and 1 if the command fails.
184.Sh EXAMPLES
185The following example shows how to create a transparent provider for disk
186.Pa /dev/da0
187with 50% write failure probability, and how to destroy it.
188.Bd -literal -offset indent
189gnop create -v -w 50 da0
190gnop destroy -v da0.nop
191.Ed
192.Pp
193The traffic statistics for the given transparent providers can be obtained
194with the
195.Cm list
196command.
197The example below shows the number of bytes written with
198.Xr newfs 8 :
199.Bd -literal -offset indent
200gnop create da0
201newfs /dev/da0.nop
202gnop list
203.Ed
204.Sh SEE ALSO
205.Xr geom 4 ,
206.Xr geom 8
207.Sh HISTORY
208The
209.Nm
210utility appeared in
211.Fx 5.3 .
212.Sh AUTHORS
213.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org
214