Wear leveling is a set of techniques used in flash memory management to distribute write and erase operations as evenly as possible across all available memory blocks, extending the usable lifetime of the storage medium. Because flash memory cells degrade after a finite number of erase cycles (typically 10,000 to 100,000 for NOR flash, and 1,000 to 10,000 for NAND flash, depending on process node), concentrating writes to the same physical locations would cause those blocks to wear out prematurely while others remain nearly unused.
In practice
Wear leveling is most relevant when using NAND flash (raw or packaged as eMMC/SD cards), NOR flash used for frequently updated data storage, and any flash-backed file system or key-value store. Managed flash devices such as SD cards, USB drives, and eMMC modules typically implement wear leveling internally in their controller firmware, so the host system generally does not need to handle it explicitly; however, the quality and aggressiveness of that implementation are vendor-specific and not guaranteed. When using raw NAND or NOR flash directly, the firmware developer must either implement wear leveling in a custom flash translation layer (FTL) or use a file system library that includes it, such as SPIFFS, LittleFS, or YAFFS.
Two broad strategies are in common use. Dynamic wear leveling remaps only blocks that hold data being actively rewritten, leaving cold (rarely updated) data in place. Static wear leveling periodically moves cold data to worn blocks and places it in fresher blocks, ensuring even wear across the entire array. Static wear leveling achieves better lifetime at the cost of additional write amplification and implementation complexity.
In bare-metal embedded systems with small NOR flash devices used for configuration or calibration data storage, wear leveling is frequently overlooked until field failures appear. A common pattern is to write a single configuration record to the same address on every power cycle, burning through the erase budget in months rather than years. A simple mitigation is a circular log or page-rotation scheme that spreads writes across a reserved flash region.
Write amplification is a closely related concern: wear leveling algorithms, especially static variants, can increase the total number of physical writes beyond what the application logically requests. On constrained devices with limited flash endurance, the overhead of the wear leveling scheme itself must be factored into lifetime calculations alongside the application write rate.
Frequently asked
Do I need to implement wear leveling myself when using an SD card or eMMC?
Generally no. SD cards and eMMC devices contain an internal controller that handles wear leveling transparently. However, the quality and aggressiveness of that implementation varies by manufacturer and is not standardized, so it should not be relied upon for safety-critical or write-intensive applications without characterization data from the vendor.
Which file systems commonly used in embedded systems include built-in wear leveling?
LittleFS and SPIFFS both include wear leveling for raw
NOR flash and are commonly used in embedded designs; LittleFS tends to be favored in newer designs. YAFFS and JFFS2 target raw
NAND flash and also include wear management. FAT, used directly on raw
flash without an FTL, provides no wear leveling at all.
What is the typical erase cycle endurance for common flash types?
Single-level cell (SLC)
NOR flash typically supports 100,000 erase cycles per block. SLC
NAND flash is in a similar range. Multi-level cell (MLC) NAND drops to roughly 3,000 to 10,000 cycles, and triple-level cell (TLC) NAND, common in consumer SD cards and eMMC, may be rated as low as 1,000 cycles. Exact figures vary by manufacturer, process node, and operating temperature, so always consult the device datasheet.
What is write amplification and why does it matter for wear leveling?
Write amplification is the ratio of physical bytes written to
flash versus logical bytes written by the application over a given interval. Wear leveling, garbage collection, and flash block management all cause additional physical writes beyond what the application requests. A write amplification factor of 2x means the flash endures twice the write traffic the application generates, effectively halving the device lifetime. Minimizing write amplification is a key design goal when choosing or tuning a wear leveling strategy on endurance-constrained devices.
How can I estimate flash lifetime for a device with wear leveling?
Estimate the average write rate in bytes per day from your application, multiply by the write amplification factor of your FTL or file system, divide by the total
flash capacity available for wear leveling, and compare the resulting erase cycles per block per day against the rated endurance. For example, a 512 KB
NOR flash region with 100,000-cycle SLC endurance and a 2x write amplification factor, written at 1 KB per day, would theoretically last on the order of decades. The same region written at 100 KB per day would last roughly 2.5 years. Add margin for temperature derating and end-of-life retention requirements.
Differentiators vs similar concepts
Wear leveling is sometimes conflated with garbage collection, but they address different problems. Garbage collection reclaims
flash blocks that contain only obsolete (logically erased) data so they can be physically erased and reused; it is a prerequisite for continued writes but does not by itself distribute wear. Wear leveling uses the information gathered during block management to choose which physical block a new write is directed to, with the goal of equalizing erase counts. In practice, most FTL and flash file system implementations combine both functions, which is why the distinction is often blurred.