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