{
  "slug": "mtd",
  "term": "Memory Technology Device (MTD)",
  "aliases": [
    "MTD",
    "Memory Technology Devices"
  ],
  "definition": "MTD is the Linux kernel subsystem providing a common interface to flash and other memory devices, including raw NAND and NOR.",
  "note": "MTD covers flash, RAM and similar devices. It exposes device operations rather than supplying a filesystem or an SSD-style translation layer. [mtd-config]\n\nRaw NAND has eraseblock, write and OOB geometry. An ECC step need not span a whole NAND page or match a host sector. [mtd-interface] [mtd-abi]\n\nUBI adds logical eraseblocks, wear management and volumes; UBIFS supplies files above UBI. [mtd-stack]\n\nIn the ECC-enabled mtd_read_oob path, nonnegative correction counts become 0 or -EUCLEAN according to bitflip_threshold; negative results are preserved. -EBADMSG does not count bad blocks or mean every returned byte is wrong. [mtd-core] [ubi-io]\n\nUserspace differs: ordinary read() on /dev/mtdX can deliver bytes despite -EUCLEAN or -EBADMSG below it. MEMREAD returns per-request ECC statistics and can report EUCLEAN for below-threshold corrections. An ioctl error is -1 with errno set, not the kernel's negative errno value. [mtd-char]\n\nMEMREAD distinguishes corrected_bitflips (total), max_bitflips (one ECC step) and uncorrectable_errors. MTD_OPS_RAW bypasses error correction. The request mode overrides the descriptor mode set by MTDFILEMODE; raw mode is not a stronger integrity check. [mtd-uapi]\n\nInspect returned len and ooblen with errno and ECC statistics. MEMREAD can copy data and still report an ECC error; returned bytes alone do not certify integrity. [mtd-char]",
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "related": [
    "nand-flash",
    "nor-flash",
    "ubi",
    "ubifs",
    "mtd-bitflip-threshold",
    "bad-block-management",
    "error-correcting-code"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-22",
  "citations": [
    {
      "id": "mtd-config",
      "title": "Linux v6.16, Memory Technology Device configuration",
      "url": "https://raw.githubusercontent.com/torvalds/linux/v6.16/drivers/mtd/Kconfig",
      "accessed": "2026-10-22"
    },
    {
      "id": "mtd-interface",
      "title": "Linux v6.16, MTD interface: device geometry and operations",
      "url": "https://raw.githubusercontent.com/torvalds/linux/v6.16/include/linux/mtd/mtd.h",
      "accessed": "2026-10-22"
    },
    {
      "id": "mtd-abi",
      "title": "Linux v6.16, MTD sysfs ABI: ECC step, strength and bitflip threshold",
      "url": "https://raw.githubusercontent.com/torvalds/linux/v6.16/Documentation/ABI/testing/sysfs-class-mtd",
      "accessed": "2026-10-22"
    },
    {
      "id": "mtd-stack",
      "title": "Linux kernel, UBIFS Authentication Support: MTD, UBI and UBIFS",
      "url": "https://docs.kernel.org/filesystems/ubifs-authentication.html",
      "accessed": "2026-10-22"
    },
    {
      "id": "mtd-core",
      "title": "Linux v6.16, mtd_read and mtd_read_oob: status conversion",
      "url": "https://raw.githubusercontent.com/torvalds/linux/v6.16/drivers/mtd/mtdcore.c",
      "accessed": "2026-10-22"
    },
    {
      "id": "ubi-io",
      "title": "Linux v6.16, ubi_io_read: corrected and uncorrectable read results",
      "url": "https://raw.githubusercontent.com/torvalds/linux/v6.16/drivers/mtd/ubi/io.c",
      "accessed": "2026-10-22"
    },
    {
      "id": "mtd-char",
      "title": "Linux v6.16, mtdchar_read and mtdchar_read_ioctl: userspace read results",
      "url": "https://raw.githubusercontent.com/torvalds/linux/v6.16/drivers/mtd/mtdchar.c",
      "accessed": "2026-10-22"
    },
    {
      "id": "mtd-uapi",
      "title": "Linux v6.16, MEMREAD request and per-operation ECC statistics",
      "url": "https://raw.githubusercontent.com/torvalds/linux/v6.16/include/uapi/mtd/mtd-abi.h",
      "accessed": "2026-10-22"
    }
  ],
  "provenance": [
    "Source review scoped to Linux v6.16. No raw-flash device, fault injection or endurance experiment was run."
  ]
}
