nbdkit-evil-filter(1)

✨ NAME ✨

okay bestie, welcome to nbdkit-evil-filter πŸ’… β€” it's the filter that adds random data corruption to reads. yes, on purpose. no cap.

it lives in the NBDKIT manual section, and it's giving "chaos monkey but for your disk reads" πŸ¦‹


🌸 SYNOPSIS 🌸

nbdkit --filter=evil PLUGIN [PLUGIN-ARGS...]
       evil=[cosmic-rays|stuck-bits|stuck-wires]
       [evil-probability=PROB] [evil-stuck-probability=PROB]
       [evil-seed=SEED]

πŸ’– DESCRIPTION πŸ’–

so like, nbdkit-evil-filter is a Byzantine filter for nbdkit(1) that randomly corrupts data when reading from the underlying plugin. literally what it says on the tin. it's the main character of "let me mess up your reads so you can test your filesystem checksums" πŸ”₯

⚠️ important bestie: it does not change write operations, so the underlying plugin still contains the correct data. the corruption is read-side only, iykyk.

nbdkit-error-filter(1) is its cousin β€” a related filter that injects hard errors into the NBD protocol. different vibe, same chaos energy.

this filter has several modes, and you pick one with the evil=... parameter. here they are:

  • evil=cosmic-rays β€” bits are flipped at random when reading data 🌈✨. the probability that a bit is flipped is controlled using the evil-probability parameter, and it defaults to 1e-8 (on average 1 in every 100 million bits read is flipped).
  • evil=stuck-bits β€” this is the default mode πŸ‘‘. fixed bits in the backing file are stuck randomly high or low. the evil-probability parameter controls the expected probability that a particular bit is stuck, defaulting in this mode to 1e-8 (1 in 100 million). evil-stuck-probability controls the probability that a stuck bit is read as its stuck value or its correct value, defaulting to 100% (always read as a stuck bit). periodt.
  • evil=stuck-wires β€” similar to stuck-bits but instead of simulating bad backing data, it simulates stuck wires along the data path (eg. in a register) 🧚. the difference is that when reading, the stuck bit always happens at the same position in the packet of data being read, regardless of where on the underlying disk it is being read from. evil-probability controls the probability of a stuck wire, defaulting in this mode to 1e-6 (1 in 1 million). evil-stuck-probability controls the probability that a stuck bit is read as its stuck value or its correct value, defaulting to 100% (always read as a stuck bit).

πŸŽ€ EXAMPLES πŸŽ€

add some stuck bits to the backing file at random:

nbdkit --filter=evil file disk.img

cosmic rays will flip (on average) one in every 100 million bits copied from the backing file over NBD:

nbdkit --filter=evil file disk.img evil=cosmic-rays \
       --run 'nbdcopy $uri output.img'

πŸ¦‹ NOTES πŸ¦‹

Extents

plugins can be sparse, bestie. this filter only corrupts bits in non-sparse parts of the backing disk and it leaves sparse regions unchanged (which is realistic behaviour, lowkey). if you wish to use this filter to corrupt sparse regions, then combine this filter with nbdkit-noextents-filter(1). for example:

nbdkit --filter=evil --filter=noextents memory 1G

Probability limited to [ 1e-12 .. 1/8 ]

the current implementation limits probabilities to the range [ 1e-12 .. 1/8 ] πŸ’€. values below this range are treated the same as 0%. values above this range are treated the same as 100%.


⭐ PARAMETERS ⭐

  • evil=cosmic-rays, evil=stuck-bits, evil=stuck-wires β€” select the mode of evil 😈. see the DESCRIPTION above. the default is stuck-bits.
  • evil-probability=N, evil-probability=N:M, evil-probability=N% β€” set the probability for the mode. you can either use a floating point number between 0 and 1, eg. evil-probability=0.001 or evil-probability=1e-6. or you can write it as N in M, eg. evil-probability=1:1000000 or evil-probability=3.33:100000. or you can write this as a percentage, eg. evil-probability=1%. the default probability depends on the mode πŸ’….
  • evil-seed=SEED β€” to make runs repeatable, use this to set a seed for the random number generator 🌱. note that runs are repeatable only if you use the same version of nbdkit, since in future we may change the algorithm. the default is to choose a seed at random.
  • evil-stuck-probability=N, evil-stuck-probability=N:M, evil-stuck-probability=N% β€” for the stuck-* modes, the probability that when reading a stuck bit you will read the stuck bit or the correct value. this defaults to 1 (ie. 100%) which means the bit is always stuck πŸ™ˆ. setting it to 0.5 for example will mean that half the time the bit appears stuck and half the time you see the correct value.

πŸ’œ FILES πŸ’œ

  • $filterdir/nbdkit-evil-filter.so β€” the filter 🫢. use nbdkit --dump-config to find the location of $filterdir.

🌈 VERSION 🌈

nbdkit-evil-filter first appeared in nbdkit 1.36 ⭐.


πŸ‘‘ SEE ALSO πŸ‘‘

nbdkit(1), nbdkit-filter(3), nbdkit-delay-filter(1), nbdkit-noextents-filter(1), nbdkit-error-filter(1), nbdkit_parse_probability(3).


πŸ“ AUTHORS πŸ“

Richard W.M. Jones


Copyright Red Hat


πŸŽ€ LICENSE πŸŽ€

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of Red Hat nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


and that's the whole page bestie!! 🌈✨ this one shipped as nbdkit version 1.48.1, dated 2026-08-29 πŸŽ€ go forth and corrupt some bits responsibly, ily πŸ’–πŸ¦‹

πŸ“¦ where this page comes from