Wear leveling – what is it?
Wear leveling is a technique that some SSD controllers use to increase the lifetime of the memory. The principle is simple: evenly distribute writing on all blocks of a SSD so they wear evenly. All cells receive the same number of writes, to avoid writing too often on the same blocks.
Flash memory in Solid State Drives (SSD’s) allows only a certain number of reading and writing processes. It usually ranges from 10,000 to 100,000. If we write 100 GB of data daily on a SSD with 400 GB of space, wear leveling ensures that the 100 GB of data is not always at the same location in the physical flash blocks. The data will distribute evenly over all the physical cells of the SSD.
Application of wear leveling
Wear leveling algorithms
There are many algorithms for wear leveling. Let us limit ourselves here to two major basic principles:
- Dynamic wear leveling
- Static wear leveling
Dynamic wear leveling
With dynamic wear leveling, only the blocks that undergo rewriting experience re-positioning to new blocks. At the time of a rewrite the algorithm selects an empty block to write the data to update.
To achieve this, the SSD controller keeps track of the number of writes to each block using a non-volatile memory. When the SSD is brand new, the counter is at 0. It is then goes up by 1 at each new write.
The dynamic wear leveling is however not optimal. Indeed, when a block is with data that is read-only or does not experience frequent updates, they do not move. It is better to place this type of data on the used blocks and place the data which is updated frequently on unused blocks.
Static wear leveling
Here, the controller selects the block in which rewrite the data from all blocks of the hard drive: it will take a block that has relatively few entries, corresponding to blocks containing static data, or empty blocks few used.
Due to these characteristics, the SSD is a hard drive that is important to optimize. Wear leveling is a recognized technique to achieve this. There are other types of optimization designed to reduce wear on SSD by limiting the volume of writing to improve durability.