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