xref: /freebsd-src/sys/contrib/openzfs/man/man8/zinject.8 (revision c6767dc1f236f20eecd75790afd42829345153da)
1eda14cbcSMatt Macy.\"
2eda14cbcSMatt Macy.\" CDDL HEADER START
3eda14cbcSMatt Macy.\"
4eda14cbcSMatt Macy.\" The contents of this file are subject to the terms of the
5eda14cbcSMatt Macy.\" Common Development and Distribution License (the "License").
6eda14cbcSMatt Macy.\" You may not use this file except in compliance with the License.
7eda14cbcSMatt Macy.\"
8eda14cbcSMatt Macy.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9271171e0SMartin Matuska.\" or https://opensource.org/licenses/CDDL-1.0.
10eda14cbcSMatt Macy.\" See the License for the specific language governing permissions
11eda14cbcSMatt Macy.\" and limitations under the License.
12eda14cbcSMatt Macy.\"
13eda14cbcSMatt Macy.\" When distributing Covered Code, include this CDDL HEADER in each
14eda14cbcSMatt Macy.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15eda14cbcSMatt Macy.\" If applicable, add the following below this CDDL HEADER, with the
16eda14cbcSMatt Macy.\" fields enclosed by brackets "[]" replaced with your own identifying
17eda14cbcSMatt Macy.\" information: Portions Copyright [yyyy] [name of copyright owner]
18eda14cbcSMatt Macy.\"
19eda14cbcSMatt Macy.\" CDDL HEADER END
20eda14cbcSMatt Macy.\"
21eda14cbcSMatt Macy.\" Copyright 2013 Darik Horn <dajhorn@vanadac.com>. All rights reserved.
22*c6767dc1SMartin Matuska.\" Copyright (c) 2024, 2025, Klara, Inc.
23eda14cbcSMatt Macy.\"
2416038816SMartin Matuska.\" lint-ok: WARNING: sections out of conventional order: Sh SYNOPSIS
2516038816SMartin Matuska.\"
26*c6767dc1SMartin Matuska.Dd January 14, 2025
2716038816SMartin Matuska.Dt ZINJECT 8
2816038816SMartin Matuska.Os
2916038816SMartin Matuska.
3016038816SMartin Matuska.Sh NAME
3116038816SMartin Matuska.Nm zinject
3216038816SMartin Matuska.Nd ZFS Fault Injector
3316038816SMartin Matuska.Sh DESCRIPTION
3416038816SMartin Matuska.Nm
3516038816SMartin Matuskacreates artificial problems in a ZFS pool by simulating data corruption
3616038816SMartin Matuskaor device failures.
3716038816SMartin MatuskaThis program is dangerous.
3816038816SMartin Matuska.
3916038816SMartin Matuska.Sh SYNOPSIS
4016038816SMartin Matuska.Bl -tag -width Ds
4116038816SMartin Matuska.It Xo
4216038816SMartin Matuska.Nm zinject
4316038816SMartin Matuska.Xc
44eda14cbcSMatt MacyList injection records.
4516038816SMartin Matuska.
4616038816SMartin Matuska.It Xo
4716038816SMartin Matuska.Nm zinject
4816038816SMartin Matuska.Fl b Ar objset : Ns Ar object : Ns Ar level : Ns Ar start : Ns Ar end
4916038816SMartin Matuska.Op Fl f Ar frequency
5016038816SMartin Matuska.Fl amu
5116038816SMartin Matuska.Op pool
5216038816SMartin Matuska.Xc
53eda14cbcSMatt MacyForce an error into the pool at a bookmark.
5416038816SMartin Matuska.
5516038816SMartin Matuska.It Xo
5616038816SMartin Matuska.Nm zinject
5716038816SMartin Matuska.Fl c Ar id Ns | Ns Sy all
5816038816SMartin Matuska.Xc
59eda14cbcSMatt MacyCancel injection records.
6016038816SMartin Matuska.
6116038816SMartin Matuska.It Xo
6216038816SMartin Matuska.Nm zinject
6316038816SMartin Matuska.Fl d Ar vdev
6416038816SMartin Matuska.Fl A Sy degrade Ns | Ns Sy fault
6516038816SMartin Matuska.Ar pool
6616038816SMartin Matuska.Xc
67eda14cbcSMatt MacyForce a vdev into the DEGRADED or FAULTED state.
6816038816SMartin Matuska.
6916038816SMartin Matuska.It Xo
7016038816SMartin Matuska.Nm zinject
7116038816SMartin Matuska.Fl d Ar vdev
7216038816SMartin Matuska.Fl D Ar latency : Ns Ar lanes
73e2257b31SMartin Matuska.Op Fl T Ar read|write
7416038816SMartin Matuska.Ar pool
7516038816SMartin Matuska.Xc
76c03c5b1cSMartin MatuskaAdd an artificial delay to I/O requests on a particular
7716038816SMartin Matuskadevice, such that the requests take a minimum of
7816038816SMartin Matuska.Ar latency
7916038816SMartin Matuskamilliseconds to complete.
8016038816SMartin MatuskaEach delay has an associated number of
8116038816SMartin Matuska.Ar lanes
8216038816SMartin Matuskawhich defines the number of concurrent
83c03c5b1cSMartin MatuskaI/O requests that can be processed.
8416038816SMartin Matuska.Pp
8516038816SMartin MatuskaFor example, with a single lane delay of 10 ms
8616038816SMartin Matuska.No (\& Ns Fl D Ar 10 : Ns Ar 1 ) ,
87c03c5b1cSMartin Matuskathe device will only be able to service a single I/O request
8816038816SMartin Matuskaat a time with each request taking 10 ms to complete.
8916038816SMartin MatuskaSo, if only a single request is submitted every 10 ms, the
90eda14cbcSMatt Macyaverage latency will be 10 ms; but if more than one request
91eda14cbcSMatt Macyis submitted every 10 ms, the average latency will be more
92eda14cbcSMatt Macythan 10 ms.
9316038816SMartin Matuska.Pp
94eda14cbcSMatt MacySimilarly, if a delay of 10 ms is specified to have two
9516038816SMartin Matuskalanes
9616038816SMartin Matuska.No (\& Ns Fl D Ar 10 : Ns Ar 2 ) ,
9716038816SMartin Matuskathen the device will be able to service
9816038816SMartin Matuskatwo requests at a time, each with a minimum latency of 10 ms.
9916038816SMartin MatuskaSo, if two requests are submitted every 10 ms, then
100eda14cbcSMatt Macythe average latency will be 10 ms; but if more than two
101eda14cbcSMatt Macyrequests are submitted every 10 ms, the average latency
102eda14cbcSMatt Macywill be more than 10 ms.
10316038816SMartin Matuska.Pp
10416038816SMartin MatuskaAlso note, these delays are additive.
10516038816SMartin MatuskaSo two invocations of
10616038816SMartin Matuska.Fl D Ar 10 : Ns Ar 1
10716038816SMartin Matuskaare roughly equivalent to a single invocation of
10816038816SMartin Matuska.Fl D Ar 10 : Ns Ar 2 .
10916038816SMartin MatuskaThis also means, that one can specify multiple
11016038816SMartin Matuskalanes with differing target latencies.
11116038816SMartin MatuskaFor example, an invocation of
11216038816SMartin Matuska.Fl D Ar 10 : Ns Ar 1
11316038816SMartin Matuskafollowed by
11416038816SMartin Matuska.Fl D Ar 25 : Ns Ar 2
11516038816SMartin Matuskawill create 3 lanes on the device: one lane with a latency
116eda14cbcSMatt Macyof 10 ms and two lanes with a 25 ms latency.
11716038816SMartin Matuska.
11816038816SMartin Matuska.It Xo
11916038816SMartin Matuska.Nm zinject
12016038816SMartin Matuska.Fl d Ar vdev
12116038816SMartin Matuska.Op Fl e Ar device_error
12216038816SMartin Matuska.Op Fl L Ar label_error
12316038816SMartin Matuska.Op Fl T Ar failure
12416038816SMartin Matuska.Op Fl f Ar frequency
12516038816SMartin Matuska.Op Fl F
12616038816SMartin Matuska.Ar pool
12716038816SMartin Matuska.Xc
128eda14cbcSMatt MacyForce a vdev error.
12916038816SMartin Matuska.
13016038816SMartin Matuska.It Xo
13116038816SMartin Matuska.Nm zinject
1320d4ad640SMartin Matuska.Fl i Ar seconds
1330d4ad640SMartin Matuska.Ar pool
1340d4ad640SMartin Matuska.Xc
1350d4ad640SMartin MatuskaAdd an artificial delay during the future import of a pool.
1360d4ad640SMartin MatuskaThis injector is automatically cleared after the import is finished.
1370d4ad640SMartin Matuska.
1380d4ad640SMartin Matuska.It Xo
1390d4ad640SMartin Matuska.Nm zinject
14016038816SMartin Matuska.Fl I
14116038816SMartin Matuska.Op Fl s Ar seconds Ns | Ns Fl g Ar txgs
14216038816SMartin Matuska.Ar pool
14316038816SMartin Matuska.Xc
144eda14cbcSMatt MacySimulate a hardware failure that fails to honor a cache flush.
14516038816SMartin Matuska.
14616038816SMartin Matuska.It Xo
14716038816SMartin Matuska.Nm zinject
14816038816SMartin Matuska.Fl p Ar function
14916038816SMartin Matuska.Ar pool
15016038816SMartin Matuska.Xc
151eda14cbcSMatt MacyPanic inside the specified function.
15216038816SMartin Matuska.
15316038816SMartin Matuska.It Xo
15416038816SMartin Matuska.Nm zinject
15516038816SMartin Matuska.Fl t Sy data
15616038816SMartin Matuska.Fl C Ar dvas
15716038816SMartin Matuska.Op Fl e Ar device_error
15816038816SMartin Matuska.Op Fl f Ar frequency
15916038816SMartin Matuska.Op Fl l Ar level
16016038816SMartin Matuska.Op Fl r Ar range
16116038816SMartin Matuska.Op Fl amq
16216038816SMartin Matuska.Ar path
16316038816SMartin Matuska.Xc
164eda14cbcSMatt MacyForce an error into the contents of a file.
16516038816SMartin Matuska.
16616038816SMartin Matuska.It Xo
16716038816SMartin Matuska.Nm zinject
16816038816SMartin Matuska.Fl t Sy dnode
16916038816SMartin Matuska.Fl C Ar dvas
17016038816SMartin Matuska.Op Fl e Ar device_error
17116038816SMartin Matuska.Op Fl f Ar frequency
17216038816SMartin Matuska.Op Fl l Ar level
17316038816SMartin Matuska.Op Fl amq
17416038816SMartin Matuska.Ar path
17516038816SMartin Matuska.Xc
176eda14cbcSMatt MacyForce an error into the metadnode for a file or directory.
17716038816SMartin Matuska.
17816038816SMartin Matuska.It Xo
17916038816SMartin Matuska.Nm zinject
18016038816SMartin Matuska.Fl t Ar mos_type
18116038816SMartin Matuska.Fl C Ar dvas
18216038816SMartin Matuska.Op Fl e Ar device_error
18316038816SMartin Matuska.Op Fl f Ar frequency
18416038816SMartin Matuska.Op Fl l Ar level
18516038816SMartin Matuska.Op Fl r Ar range
18616038816SMartin Matuska.Op Fl amqu
18716038816SMartin Matuska.Ar pool
18816038816SMartin Matuska.Xc
189eda14cbcSMatt MacyForce an error into the MOS of a pool.
19016038816SMartin Matuska.El
19116038816SMartin Matuska.Sh OPTIONS
19216038816SMartin Matuska.Bl -tag -width "-C dvas"
19316038816SMartin Matuska.It Fl a
194eda14cbcSMatt MacyFlush the ARC before injection.
19516038816SMartin Matuska.It Fl b Ar objset : Ns Ar object : Ns Ar level : Ns Ar start : Ns Ar end
19616038816SMartin MatuskaForce an error into the pool at this bookmark tuple.
19716038816SMartin MatuskaEach number is in hexadecimal, and only one block can be specified.
19816038816SMartin Matuska.It Fl C Ar dvas
19916038816SMartin MatuskaInject the given error only into specific DVAs.
20016038816SMartin MatuskaThe mask should be specified as a list of 0-indexed DVAs separated by commas
201c03c5b1cSMartin Matuska.No (e.g . Ar 0,2 Ns No ).
20216038816SMartin MatuskaThis option is not applicable to logical data errors such as
20316038816SMartin Matuska.Sy decompress
204eda14cbcSMatt Macyand
20516038816SMartin Matuska.Sy decrypt .
20616038816SMartin Matuska.It Fl d Ar vdev
207eda14cbcSMatt MacyA vdev specified by path or GUID.
20816038816SMartin Matuska.It Fl e Ar device_error
209eda14cbcSMatt MacySpecify
21016038816SMartin Matuska.Bl -tag -compact -width "decompress"
21116038816SMartin Matuska.It Sy checksum
21216038816SMartin Matuskafor an ECKSUM error,
21316038816SMartin Matuska.It Sy decompress
21416038816SMartin Matuskafor a data decompression error,
21516038816SMartin Matuska.It Sy decrypt
21616038816SMartin Matuskafor a data decryption error,
21716038816SMartin Matuska.It Sy corrupt
21816038816SMartin Matuskato flip a bit in the data after a read,
21916038816SMartin Matuska.It Sy dtl
22016038816SMartin Matuskafor an ECHILD error,
22116038816SMartin Matuska.It Sy io
2221719886fSMartin Matuskafor an EIO error where reopening the device will succeed,
22316038816SMartin Matuska.It Sy nxio
2241719886fSMartin Matuskafor an ENXIO error where reopening the device will fail, or
2251719886fSMartin Matuska.It Sy noop
2261719886fSMartin Matuskato drop the IO without executing it, and return success.
22716038816SMartin Matuska.El
22816038816SMartin Matuska.Pp
22916038816SMartin MatuskaFor EIO and ENXIO, the "failed" reads or writes still occur.
23016038816SMartin MatuskaThe probe simply sets the error value reported by the I/O pipeline
23116038816SMartin Matuskaso it appears the read or write failed.
23216038816SMartin MatuskaDecryption errors only currently work with file data.
23316038816SMartin Matuska.It Fl f Ar frequency
23416038816SMartin MatuskaOnly inject errors a fraction of the time.
23516038816SMartin MatuskaExpressed as a real number percentage between
23616038816SMartin Matuska.Sy 0.0001
23716038816SMartin Matuskaand
23816038816SMartin Matuska.Sy 100 .
23916038816SMartin Matuska.It Fl F
24016038816SMartin MatuskaFail faster.
24116038816SMartin MatuskaDo fewer checks.
24216038816SMartin Matuska.It Fl f Ar txgs
243eda14cbcSMatt MacyRun for this many transaction groups before reporting failure.
24416038816SMartin Matuska.It Fl h
245eda14cbcSMatt MacyPrint the usage message.
24616038816SMartin Matuska.It Fl l Ar level
24716038816SMartin MatuskaInject an error at a particular block level.
24816038816SMartin MatuskaThe default is
24916038816SMartin Matuska.Sy 0 .
25016038816SMartin Matuska.It Fl L Ar label_error
251eda14cbcSMatt MacySet the label error region to one of
25216038816SMartin Matuska.Sy nvlist ,
25316038816SMartin Matuska.Sy pad1 ,
25416038816SMartin Matuska.Sy pad2 ,
25516038816SMartin Matuskaor
25616038816SMartin Matuska.Sy uber .
25716038816SMartin Matuska.It Fl m
258eda14cbcSMatt MacyAutomatically remount the underlying filesystem.
25916038816SMartin Matuska.It Fl q
26016038816SMartin MatuskaQuiet mode.
26116038816SMartin MatuskaOnly print the handler number added.
26216038816SMartin Matuska.It Fl r Ar range
263eda14cbcSMatt MacyInject an error over a particular logical range of an object, which
264eda14cbcSMatt Macywill be translated to the appropriate blkid range according to the
265eda14cbcSMatt Macyobject's properties.
26616038816SMartin Matuska.It Fl s Ar seconds
267eda14cbcSMatt MacyRun for this many seconds before reporting failure.
268*c6767dc1SMartin Matuska.It Fl T Ar type
269*c6767dc1SMartin MatuskaInject the error into I/O of this type.
270*c6767dc1SMartin Matuska.Bl -tag -compact -width "read, write, flush, claim, free"
271*c6767dc1SMartin Matuska.It Sy read , Sy write , Sy flush , Sy claim , Sy free
272*c6767dc1SMartin MatuskaFundamental I/O types
273*c6767dc1SMartin Matuska.It Sy all
274*c6767dc1SMartin MatuskaAll fundamental I/O types
275*c6767dc1SMartin Matuska.It Sy probe
276*c6767dc1SMartin MatuskaDevice probe I/O
277*c6767dc1SMartin Matuska.El
27816038816SMartin Matuska.It Fl t Ar mos_type
279eda14cbcSMatt MacySet this to
28016038816SMartin Matuska.Bl -tag -compact -width "spacemap"
28116038816SMartin Matuska.It Sy mos
28216038816SMartin Matuskafor any data in the MOS,
28316038816SMartin Matuska.It Sy mosdir
28416038816SMartin Matuskafor an object directory,
28516038816SMartin Matuska.It Sy config
28616038816SMartin Matuskafor the pool configuration,
28716038816SMartin Matuska.It Sy bpobj
28816038816SMartin Matuskafor the block pointer list,
28916038816SMartin Matuska.It Sy spacemap
29016038816SMartin Matuskafor the space map,
29116038816SMartin Matuska.It Sy metaslab
29216038816SMartin Matuskafor the metaslab, or
29316038816SMartin Matuska.It Sy errlog
29416038816SMartin Matuskafor the persistent error log.
29516038816SMartin Matuska.El
29616038816SMartin Matuska.It Fl u
297eda14cbcSMatt MacyUnload the pool after injection.
29816038816SMartin Matuska.El
29916038816SMartin Matuska.
30016038816SMartin Matuska.Sh ENVIRONMENT VARIABLES
30116038816SMartin Matuska.Bl -tag -width "ZF"
30216038816SMartin Matuska.It Ev ZFS_HOSTID
30316038816SMartin MatuskaRun
30416038816SMartin Matuska.Nm
30516038816SMartin Matuskain debug mode.
30616038816SMartin Matuska.El
30716038816SMartin Matuska.
30816038816SMartin Matuska.Sh SEE ALSO
30916038816SMartin Matuska.Xr zfs 8 ,
31016038816SMartin Matuska.Xr zpool 8
311