ZINJECT(8)
π NAME π
zinject β the ZFS Fault Injector, aka the girl who starts drama on purpose π
π DESCRIPTION π
Okay bestie, listen. zinject creates artificial problems in a ZFS pool by simulating data corruption or device failures. That's the whole gig. She's a chaos agent, an icon, a menace. π
β οΈ This program is dangerous. Like, actually dangerous. Not "oops I deleted a selfie" dangerous. Handle with care, fr fr. π
β¨ SYNOPSIS β¨
zinject
List injection records.
zinject -b objset:object:level:start:end [-f frequency] -amu [pool]
Force an error into the pool at a bookmark.
zinject -c id|all
Cancel injection records.
zinject -d vdev -A degrade|fault pool
Force a vdev into the DEGRADED or FAULTED state.
zinject -d vdev -D latency:lanes [-T read|write] pool
Add an artificial delay to I/O requests on a particular device,
such that the requests take a minimum of latency milliseconds to
complete. Each delay has an associated number of lanes which
defines the number of concurrent I/O requests that can be
processed.
For example, with a single lane delay of 10 ms (-D 10:1), the
device will only be able to service a single I/O request at a
time with each request taking 10 ms to complete. So, if only a
single request is submitted every 10 ms, the average latency
will be 10 ms; but if more than one request is submitted every
10 ms, the average latency will be more than 10 ms.
Similarly, if a delay of 10 ms is specified to have two lanes
(-D 10:2), then the device will be able to service two requests
at a time, each with a minimum latency of 10 ms. So, if two
requests are submitted every 10 ms, then the average latency
will be 10 ms; but if more than two requests are submitted every
10 ms, the average latency will be more than 10 ms.
Also note, these delays are additive. So two invocations of -D
10:1 are roughly equivalent to a single invocation of -D 10:2.
This also means, that one can specify multiple lanes with
differing target latencies. For example, an invocation of -D
10:1 followed by -D 25:2 will create 3 lanes on the device: one
lane with a latency of 10 ms and two lanes with a 25 ms latency.
zinject -d vdev [-e device_error] [-L label_error] [-T failure]
[-f frequency] [-F] pool
Force a vdev error.
zinject -i seconds pool
Add an artificial delay during the future import of a pool.
This injector is automatically cleared after the import is
finished.
zinject -E delay [-a] [-m] [-f freq] [-l level] [-r range] [-T iotype]
[-t type|-b bookmark]
Inject pipeline ready stage delays for the given object or
bookmark. The delay is specified in milliseconds.
zinject -I [-s seconds|-g txgs] pool
Simulate a hardware failure that fails to honor a cache flush.
zinject -p function pool
Panic inside the specified function.
zinject -t data -C dvas [-e device_error] [-f frequency] [-l level]
[-r range] [-amq] path
Force an error into the contents of a file.
zinject -t dnode -C dvas [-e device_error] [-f frequency] [-l level]
[-amq] path
Force an error into the metadnode for a file or directory.
zinject -t mos_type -C dvas [-e device_error] [-f frequency] [-l level]
[-r range] [-amqu] pool
Force an error into the MOS of a pool.
π OPTIONS π
Bestie, there's a lot. Grab a snack. π
-aβ Flush the ARC before injection. Clean slate energy β¨-b objset:object:level:start:endβ Force an error into the pool at this bookmark tuple. Every number is in hexadecimal, and you can only specify one block. One. Singular. Periodt. π-C dvasβ Inject the given error only into specific DVAs. The mask goes in as a list of 0-indexed DVAs separated by commas (like0,2). Heads up: this option is not applicable to logical data errors like decompress and decrypt. π«-d vdevβ A vdev, specified by path or by GUID. π¦-e device_errorβ Pick your poison:checksumβ for an ECKSUM errordecompressβ for a data decompression errordecryptβ for a data decryption errorcorruptβ to flip a bit in the data after a readdtlβ for an ECHILD errorioβ for an EIO error where reopening the device will succeednxioβ for an ENXIO error where reopening the device will failnoopβ to drop the IO without executing it, and return success
For EIO and ENXIO, the "failed" reads or writes still occur. The probe simply sets the error value reported by the I/O pipeline so it appears the read or write failed. Sneaky! π And decryption errors only currently work with file data.
-f frequencyβ Only inject errors a fraction of the time. It's a real number percentage between0.0001and100. β¨-Fβ Fail faster. Do fewer checks. Speedrun the failure, slay. π₯-f txgsβ Run for this many transaction groups before reporting failure.-hβ Print the usage message. The "help me I'm lost" button. π«Ά-l levelβ Inject an error at a particular block level. The default is0. π-L label_errorβ Set the label error region to one ofnvlist,pad1,pad2, oruber.-mβ Automatically remount the underlying filesystem.-qβ Quiet mode. Only prints the handler number that got added. Shy girl behavior. π€«-r rangeβ Inject an error over a particular logical range of an object, which gets translated to the appropriate blkid range according to the object's properties. π-s secondsβ Run for this many seconds before reporting failure.-T typeβ Inject the error into I/O of this type:read,write,flush,claim,freeβ Fundamental I/O typesallβ All fundamental I/O typesprobeβ Device probe I/O
-t mos_typeβ Set this to:mosβ for any data in the MOSmosdirβ for an object directoryconfigβ for the pool configurationbpobjβ for the block pointer listspacemapβ for the space mapmetaslabβ for the metaslaberrlogβ for the persistent error log
-uβ Unload the pool after injection. Bye bestie π
π¦ ENVIRONMENT VARIABLES π¦
ZFS_HOSTIDβ Runzinjectin debug mode. π
π SEE ALSO π
zfs(8), zpool(8) β go read the girlies she hangs out with π«Ά
That's the whole page, babe. Written up by the OpenZFS girlies, dated January 14, 2025 β go cause problems on purpose, but like, responsibly. πβ¨π
π¦ where this page comes from
- alpine 3.23: zfs-doc 2.4.4-r0 Β· CDDL-1.0
- alpine 3.24: zfs-doc 2.4.4-r0 Β· CDDL-1.0
- nixos 26.05: zfs-user 2.4.4
- nixpkgs unstable: zfs-user 2.4.4
- ubuntu resolute: zfs-test 2.4.1-1ubuntu5 Β· CDDL-1.0
- ubuntu resolute: zfs-test 2.4.1-1ubuntu5.1 Β· CDDL-1.0
- ubuntu stonking: zfs-test 2.4.4-1ubuntu4 Β· CDDL-1.0
- π the page's license: CDDL-1.0
- Copyright 2013 Darik Horn <dajhorn@vanadac.com>. All rights reserved
- Copyright (c) 2024, 2025, Klara, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms