Bad block management
Bad block management identifies and excludes NAND eraseblocks that are unusable at manufacture or become unusable during service.
Raw NAND relies on an external controller or software stack for bad-block handling. Managed NAND integrates that responsibility; on-die ECC alone does not provide it. [1]
Retiring a block prevents its reuse but does not reconstruct unreadable bytes. In Linux v6.16, UBI's recover_peb path attempts to copy readable prior data and retry the failed write in another physical eraseblock. Recovery can fail; the dynamic-volume write path then enters read-only mode. [2]
Corrected bitflips, uncorrectable ECC errors and retirement are distinct events. UBI's I/O layer distinguishes corrected data from an uncorrectable ECC read result, while its wear-leveling layer can relocate data for scrubbing. The corrected-bitflip notification is governed by MTD's bitflip_threshold per ECC step, not by every individual corrected bit. [6] A corrected read therefore does not by itself mean a block was permanently marked bad. [5] [3]
Linux v6.16 defaults MTD_UBI_BEB_LIMIT to 20 maximum expected bad eraseblocks per 1024, using the entire NAND chip rather than only the attached partition. This configurable planning limit is not a universal SSD spare percentage. In the erase-worker bad-block path, an empty reserved pool can be supplemented by available unallocated eraseblocks; if both pools are empty, UBI switches to read-only mode. [4] [3]
Relations
- related
- Flash translation layer (FTL), NAND flash, Solid-state drive (SSD), Wear leveling, Over-provisioning, SSD controller, S.M.A.R.T., NOR flash, Byte-addressable storage, Unsorted Block Images (UBI), UBI File System (UBIFS), Memory Technology Device (MTD), MTD bitflip threshold, Bad block table
Limitations
- A read-only transition stops writes but does not certify that every previously stored byte remains readable.
Citations
- Micron. Choosing the right NAND: raw, managed and on-die ECC
- Linux v6.16, drivers/mtd/ubi/eba.c: try_recover_peb, recover_peb and ubi_eba_write_leb
- Linux v6.16, drivers/mtd/ubi/wl.c: scrubbing and __erase_worker bad-block reserve handling
- Linux v6.16, drivers/mtd/ubi/Kconfig: MTD_UBI_BEB_LIMIT and whole-chip sizing
- Linux v6.16, drivers/mtd/ubi/io.c: ubi_io_read return values and corrected versus uncorrectable errors
- Linux v6.16, MTD sysfs ABI: bitflip_threshold and ECC-step reporting