Definition

wear leveling

Wear leveling is a process that is designed to extend the life of solid-state storage devices.

Solid-state storage is made up of microchips that store data in blocks. Each block can tolerate a finite number of program/erase cycles before becoming unreliable. For example, single-level cell (SLC) NAND flash is typically rated at between 50,000 and 100,000 program/erase cycles. Wear leveling arranges data so that write/erase cycles are distributed evenly among all of the blocks in the device.

Wear leveling is typically managed by the flash controller, which uses a wear leveling algorithm to determine which physical block to use each time data is programmed.

Wear leveling is perhaps even more important in multi-level cell (MLC) NAND flash devices. Where SLC allows a single bit to be written into a memory block, two can be written into MLC blocks at once. This helps bring the cost of solid-state drives (SSDs) down, but increases the wear. To help ease that wear increase, enterprise SSDs use enterprise MLC, or eMLC, which slows the write speed, reducing wear rates.

Dynamic vs. static wear leveling

There are two types of SSD wear leveling: dynamic and static. Dynamic wear leveling pools erased blocks and selects the block with the lowest erase count for the next write. The downside of dynamic wear leveling is that if a block holds data that is not accessed, it is never moved to a different block. This limits the number of blocks undergoing wear leveling in an SSD.

Static wear leveling operates like dynamic wear leveling, but it also ensures that blocks of static data are moved when their block erase count falls below a certain threshold. This additional step of moving data can slow write performance due to overhead on the flash controller, but static wear leveling is considerably more effective than dynamic wear leveling for extending the life span of solid-state devices.

Wear leveling vs. TRIM

The TRIM command set in a computer operating system (OS) instructs a NAND flash device when a memory block is no longer in use and can be erased. The term TRIM applies to serial ATA (SATA) SSDs. In SAS-based SSDs, a similar command set is called UNMAP.

Wear leveling, on the other hand, is managed by the flash controller, not the OS. Unlike TRIM, wear leveling only functions when data is being written to the SSD, calling on the flash controller to identify the set of blocks with the lowest P/E cycle counts so data can be written to them. TRIM activity occurs when the OS has been informed that a memory block is no longer holding data.

TRIM is supported by nearly all computer and server OSes, and it has been supported by the Android mobile OS since 2013.

Wear leveling vs. garbage collection

Garbage collection is another method of improving the functional life and write performance of an SSD.

Memory cells in an SSD are made up of blocks, and each instance of data is written into each block in a set number of pages. Individual pages can be updated with a new write, but data in a NAND flash cell has to be erased an entire block at a time. This means small data updates waste erase cycles for the unused pages in a block.

During garbage collection, all of the pages being written to in a block are moved to a new block and the unchanged pages in the previous block are erased. This completely frees up the previous block for use in wear leveling.

This was last updated in February 2018

Continue Reading About wear leveling

Dig Deeper on Flash memory and storage

Disaster Recovery
Data Backup
Data Center
Sustainability and ESG
Close