Documentation/admin-guide/device-mapper/dm-dust.rst

Source file repositories/reference/linux-study-clean/Documentation/admin-guide/device-mapper/dm-dust.rst

File Facts

System
Linux kernel
Corpus path
Documentation/admin-guide/device-mapper/dm-dust.rst
Extension
.rst
Size
10252 bytes
Lines
306
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

dm-dust
=======

This target emulates the behavior of bad sectors at arbitrary
locations, and the ability to enable the emulation of the failures
at an arbitrary time.

This target behaves similarly to a linear target.  At a given time,
the user can send a message to the target to start failing read
requests on specific blocks (to emulate the behavior of a hard disk
drive with bad sectors).

When the failure behavior is enabled (i.e.: when the output of
"dmsetup status" displays "fail_read_on_bad_block"), reads of blocks
in the "bad block list" will fail with EIO ("Input/output error").

Writes of blocks in the "bad block list will result in the following:

1. Remove the block from the "bad block list".
2. Successfully complete the write.

This emulates the "remapped sector" behavior of a drive with bad
sectors.

Normally, a drive that is encountering bad sectors will most likely
encounter more bad sectors, at an unknown time or location.
With dm-dust, the user can use the "addbadblock" and "removebadblock"
messages to add arbitrary bad blocks at new locations, and the
"enable" and "disable" messages to modulate the state of whether the
configured "bad blocks" will be treated as bad, or bypassed.
This allows the pre-writing of test data and metadata prior to
simulating a "failure" event where bad sectors start to appear.

Table parameters
----------------
<device_path> <offset> <blksz>

Mandatory parameters:
    <device_path>:
        Path to the block device.

    <offset>:
        Offset to data area from start of device_path

    <blksz>:
        Block size in bytes

	     (minimum 512, maximum 1073741824, must be a power of 2)

Usage instructions
------------------

First, find the size (in 512-byte sectors) of the device to be used::

        $ sudo blockdev --getsz /dev/vdb1
        33552384

Create the dm-dust device:
(For a device with a block size of 512 bytes)

::

        $ sudo dmsetup create dust1 --table '0 33552384 dust /dev/vdb1 0 512'

(For a device with a block size of 4096 bytes)

::

        $ sudo dmsetup create dust1 --table '0 33552384 dust /dev/vdb1 0 4096'

Annotation

Implementation Notes