]> git.proxmox.com Git - mirror_zfs.git/blob - man/man8/zinject.8
FreeBSD: Add zfs_link_create() error handling
[mirror_zfs.git] / man / man8 / zinject.8
1 .\"
2 .\" CDDL HEADER START
3 .\"
4 .\" The contents of this file are subject to the terms of the
5 .\" Common Development and Distribution License (the "License").
6 .\" You may not use this file except in compliance with the License.
7 .\"
8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 .\" or https://opensource.org/licenses/CDDL-1.0.
10 .\" See the License for the specific language governing permissions
11 .\" and limitations under the License.
12 .\"
13 .\" When distributing Covered Code, include this CDDL HEADER in each
14 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 .\" If applicable, add the following below this CDDL HEADER, with the
16 .\" fields enclosed by brackets "[]" replaced with your own identifying
17 .\" information: Portions Copyright [yyyy] [name of copyright owner]
18 .\"
19 .\" CDDL HEADER END
20 .\"
21 .\" Copyright 2013 Darik Horn <dajhorn@vanadac.com>. All rights reserved.
22 .\" Copyright (c) 2024, Klara Inc.
23 .\"
24 .\" lint-ok: WARNING: sections out of conventional order: Sh SYNOPSIS
25 .\"
26 .Dd April 4, 2024
27 .Dt ZINJECT 8
28 .Os
29 .
30 .Sh NAME
31 .Nm zinject
32 .Nd ZFS Fault Injector
33 .Sh DESCRIPTION
34 .Nm
35 creates artificial problems in a ZFS pool by simulating data corruption
36 or device failures.
37 This program is dangerous.
38 .
39 .Sh SYNOPSIS
40 .Bl -tag -width Ds
41 .It Xo
42 .Nm zinject
43 .Xc
44 List injection records.
45 .
46 .It Xo
47 .Nm zinject
48 .Fl b Ar objset : Ns Ar object : Ns Ar level : Ns Ar start : Ns Ar end
49 .Op Fl f Ar frequency
50 .Fl amu
51 .Op pool
52 .Xc
53 Force an error into the pool at a bookmark.
54 .
55 .It Xo
56 .Nm zinject
57 .Fl c Ar id Ns | Ns Sy all
58 .Xc
59 Cancel injection records.
60 .
61 .It Xo
62 .Nm zinject
63 .Fl d Ar vdev
64 .Fl A Sy degrade Ns | Ns Sy fault
65 .Ar pool
66 .Xc
67 Force a vdev into the DEGRADED or FAULTED state.
68 .
69 .It Xo
70 .Nm zinject
71 .Fl d Ar vdev
72 .Fl D Ar latency : Ns Ar lanes
73 .Op Fl T Ar read|write
74 .Ar pool
75 .Xc
76 Add an artificial delay to I/O requests on a particular
77 device, such that the requests take a minimum of
78 .Ar latency
79 milliseconds to complete.
80 Each delay has an associated number of
81 .Ar lanes
82 which defines the number of concurrent
83 I/O requests that can be processed.
84 .Pp
85 For example, with a single lane delay of 10 ms
86 .No (\& Ns Fl D Ar 10 : Ns Ar 1 ) ,
87 the device will only be able to service a single I/O request
88 at a time with each request taking 10 ms to complete.
89 So, if only a single request is submitted every 10 ms, the
90 average latency will be 10 ms; but if more than one request
91 is submitted every 10 ms, the average latency will be more
92 than 10 ms.
93 .Pp
94 Similarly, if a delay of 10 ms is specified to have two
95 lanes
96 .No (\& Ns Fl D Ar 10 : Ns Ar 2 ) ,
97 then the device will be able to service
98 two requests at a time, each with a minimum latency of 10 ms.
99 So, if two requests are submitted every 10 ms, then
100 the average latency will be 10 ms; but if more than two
101 requests are submitted every 10 ms, the average latency
102 will be more than 10 ms.
103 .Pp
104 Also note, these delays are additive.
105 So two invocations of
106 .Fl D Ar 10 : Ns Ar 1
107 are roughly equivalent to a single invocation of
108 .Fl D Ar 10 : Ns Ar 2 .
109 This also means, that one can specify multiple
110 lanes with differing target latencies.
111 For example, an invocation of
112 .Fl D Ar 10 : Ns Ar 1
113 followed by
114 .Fl D Ar 25 : Ns Ar 2
115 will create 3 lanes on the device: one lane with a latency
116 of 10 ms and two lanes with a 25 ms latency.
117 .
118 .It Xo
119 .Nm zinject
120 .Fl d Ar vdev
121 .Op Fl e Ar device_error
122 .Op Fl L Ar label_error
123 .Op Fl T Ar failure
124 .Op Fl f Ar frequency
125 .Op Fl F
126 .Ar pool
127 .Xc
128 Force a vdev error.
129 .
130 .It Xo
131 .Nm zinject
132 .Fl I
133 .Op Fl s Ar seconds Ns | Ns Fl g Ar txgs
134 .Ar pool
135 .Xc
136 Simulate a hardware failure that fails to honor a cache flush.
137 .
138 .It Xo
139 .Nm zinject
140 .Fl p Ar function
141 .Ar pool
142 .Xc
143 Panic inside the specified function.
144 .
145 .It Xo
146 .Nm zinject
147 .Fl t Sy data
148 .Fl C Ar dvas
149 .Op Fl e Ar device_error
150 .Op Fl f Ar frequency
151 .Op Fl l Ar level
152 .Op Fl r Ar range
153 .Op Fl amq
154 .Ar path
155 .Xc
156 Force an error into the contents of a file.
157 .
158 .It Xo
159 .Nm zinject
160 .Fl t Sy dnode
161 .Fl C Ar dvas
162 .Op Fl e Ar device_error
163 .Op Fl f Ar frequency
164 .Op Fl l Ar level
165 .Op Fl amq
166 .Ar path
167 .Xc
168 Force an error into the metadnode for a file or directory.
169 .
170 .It Xo
171 .Nm zinject
172 .Fl t Ar mos_type
173 .Fl C Ar dvas
174 .Op Fl e Ar device_error
175 .Op Fl f Ar frequency
176 .Op Fl l Ar level
177 .Op Fl r Ar range
178 .Op Fl amqu
179 .Ar pool
180 .Xc
181 Force an error into the MOS of a pool.
182 .El
183 .Sh OPTIONS
184 .Bl -tag -width "-C dvas"
185 .It Fl a
186 Flush the ARC before injection.
187 .It Fl b Ar objset : Ns Ar object : Ns Ar level : Ns Ar start : Ns Ar end
188 Force an error into the pool at this bookmark tuple.
189 Each number is in hexadecimal, and only one block can be specified.
190 .It Fl C Ar dvas
191 Inject the given error only into specific DVAs.
192 The mask should be specified as a list of 0-indexed DVAs separated by commas
193 .No (e.g . Ar 0,2 Ns No ).
194 This option is not applicable to logical data errors such as
195 .Sy decompress
196 and
197 .Sy decrypt .
198 .It Fl d Ar vdev
199 A vdev specified by path or GUID.
200 .It Fl e Ar device_error
201 Specify
202 .Bl -tag -compact -width "decompress"
203 .It Sy checksum
204 for an ECKSUM error,
205 .It Sy decompress
206 for a data decompression error,
207 .It Sy decrypt
208 for a data decryption error,
209 .It Sy corrupt
210 to flip a bit in the data after a read,
211 .It Sy dtl
212 for an ECHILD error,
213 .It Sy io
214 for an EIO error where reopening the device will succeed, or
215 .It Sy nxio
216 for an ENXIO error where reopening the device will fail.
217 .El
218 .Pp
219 For EIO and ENXIO, the "failed" reads or writes still occur.
220 The probe simply sets the error value reported by the I/O pipeline
221 so it appears the read or write failed.
222 Decryption errors only currently work with file data.
223 .It Fl f Ar frequency
224 Only inject errors a fraction of the time.
225 Expressed as a real number percentage between
226 .Sy 0.0001
227 and
228 .Sy 100 .
229 .It Fl F
230 Fail faster.
231 Do fewer checks.
232 .It Fl f Ar txgs
233 Run for this many transaction groups before reporting failure.
234 .It Fl h
235 Print the usage message.
236 .It Fl l Ar level
237 Inject an error at a particular block level.
238 The default is
239 .Sy 0 .
240 .It Fl L Ar label_error
241 Set the label error region to one of
242 .Sy nvlist ,
243 .Sy pad1 ,
244 .Sy pad2 ,
245 or
246 .Sy uber .
247 .It Fl m
248 Automatically remount the underlying filesystem.
249 .It Fl q
250 Quiet mode.
251 Only print the handler number added.
252 .It Fl r Ar range
253 Inject an error over a particular logical range of an object, which
254 will be translated to the appropriate blkid range according to the
255 object's properties.
256 .It Fl s Ar seconds
257 Run for this many seconds before reporting failure.
258 .It Fl T Ar failure
259 Set the failure type to one of
260 .Sy all ,
261 .Sy ioctl ,
262 .Sy claim ,
263 .Sy free ,
264 .Sy read ,
265 or
266 .Sy write .
267 .It Fl t Ar mos_type
268 Set this to
269 .Bl -tag -compact -width "spacemap"
270 .It Sy mos
271 for any data in the MOS,
272 .It Sy mosdir
273 for an object directory,
274 .It Sy config
275 for the pool configuration,
276 .It Sy bpobj
277 for the block pointer list,
278 .It Sy spacemap
279 for the space map,
280 .It Sy metaslab
281 for the metaslab, or
282 .It Sy errlog
283 for the persistent error log.
284 .El
285 .It Fl u
286 Unload the pool after injection.
287 .El
288 .
289 .Sh ENVIRONMENT VARIABLES
290 .Bl -tag -width "ZF"
291 .It Ev ZFS_HOSTID
292 Run
293 .Nm
294 in debug mode.
295 .El
296 .
297 .Sh SEE ALSO
298 .Xr zfs 8 ,
299 .Xr zpool 8