What is wear levelling?
Wear levelling (wear uniform) is a technique used by some solid state drives (SSD) controllers to increase the memory’s lifetime. The principle is simple: evenly distribute the entries for all blocks of SSDs so they will wear out evenly.
All cells receive the same number of writes, to avoid writing too often on the same blocks and therefore wearing these off faster that the rest.
Flash memory and flash cell of SSD’s allow a certain number of reading and writing processes. It usually goes from 10,000 to 100,000. On an SSD with 400 GB of space, we write and delete 100 GB of data every single day. Wear levelling will ensure that these 100GB of data are not written always at the same location in the physical flash blocks, but distributed evenly throughout all the physical cells of the SSD.
Simply put, it will divide the 400 GB of physical memory in 4 blocks of 100 GB each and call it blocks 1, 2, 3 and 4. Thus, when you write 100GB of data on day 1, it is written in block 1 when you delete and rewrite data on day 2, then it will be write in block 2 and so on. This ensures that all physical cells are used consistently to improve the lifespan of the SSD.
Wear levelling applications
Wear levelling can be deployed via a microcontroller or firmware that controls the write cycles per cell or by files made for flash memory systems.
Wear levelling algorithms
There are many algorithms for wear levelling. Today we’ll focus on the two main basic principles:
- Dynamic wear levelling
- Static wear levelling
Dynamic wear levelling
With dynamic wear levelling, only the blocks that are rewritten are moved to new blocks. At the time of any given rewrite the algorithm selects an empty block to write the updated data.
To achieve this, the SSD controller keeps track of the number of writes to each block via a non-volatile memory. When the SSD is brand new and unused, the counter is at 0. It is then incremented by 1 with each new write.
The dynamic wear levelling is however not optimised. A block is assigned to record data that is read-only or that doesn’t get frequently updated, and will not be moved from there. It is better to place this type of data on used blocks and record the data that is frequently updated in more worn blocks.
Static wear levelling
In this case, the controller selects the area from any block in the hard drive to rewrite the data: it will choose the block that has relatively fewer entries, e.g. corresponding to blocks containing static data, or empty blocks that aren’t used as often.
Due to its inherent characteristics, it is important to optimise an SSD. Wear levelling is a recognised technique that can achieve this but there are also other types of optimisation which will reduce wear on SSDs by limiting the volume of writing to improve its durability, but that is a matter for another post.
Michael Nuncic is Marketing Communications Manager at the German Ontrack Data Recovery office in Böblingen for more than 5 years. Highly experienced in computer, network and software topics, he is a professional editor for blog and technical articles for almost 20 years now.