Wear leveling and how it impacts SSD life expectancy

Wear leveling and how it impacts SSD life expectancy

Wear leveling and how it impacts SSD life expectancy

Wear leveling is a flash controller feature that maximizes the life expectancy of NAND flash storage systems. But how does it work and why do we need it?

Wear leveling is function that’s carried out by almost all flash memory controllers. It’s a process that maximizes the life and reliability of your SSD drive or any storage device based on NAND flash memory. It does this by spreading out wear evenly across all the blocks on the flash memory.

Why do NAND flash storage systems need wear leveling?

Data in flash memory is arranged in a hierarchy of cells, pages and blocks. Data is written one page at a time but, because of the architecture, NAND flash can only be erased at the block level.

There is a limit to the number of times flash cells can be erased. After that, they become increasingly less reliable. Errors can be corrected, but frequent errors indicate that a block is reaching the end of its useful life.

When it comes to SSDs and NAND flash based storage systems, there will be some data that is rarely used or only accessed for read, and other data that is frequently updated. If some blocks are written to, and hence erased, more frequently than others, then they will become unusable earlier than others. This reduces the capacity and, eventually, the usable lifetime of the whole flash memory.

To maximize the life of the SSD, it is important to ensure that all blocks are erased roughly the same number of times. This process is called “wear leveling”.

How is wear leveling carried out? 

The main goal of wear leveling is to even out the use of blocks in the flash memory. The simplest approach is to keep a count of how many times each block has been erased. Then, when a block is needed to store some data, the empty block with the lowest erase count is used. This helps spread the block use out more evenly.

This approach is called “dynamic wear leveling”. It has the disadvantage that it only works for blocks that are being written to.

For example, imagine you get a new SSD and immediately fill half of it with your family photos. Those blocks will have an initial erase count of 1.

Then you start using the SSD for your usual activities: creating, editing and copying documents. All of this happens in the other half of the SSD so the erase count of those blocks slowly increases. Meanwhile, the blocks with your photos are still sitting there with an erase count of 1.

To make sure that this uneven use doesn’t shorten the life of the SSD, a technique called “static wear levelling” is used. This makes use of the blocks that are rarely updated to keep erase counts low.

When the SSD controller erases a block, the erase count is compared with the currently used blocks. If the difference between them reaches some predefined threshold, then one of the currently used blocks will be freed up for future use.

For example, if the wear-level threshold is 32 then when the controller erases a block for the 33rd time it will see that the difference between that and the blocks containing your photos (erase count =1) is equal to the threshold. The controller will therefore copy photos from one of those blocks into the newly erased block. It will then erase the block that contained the photos, bringing its erase count up to 2, and make it available on the list of empty blocks. This process ensures that all of the blocks in the flash memory are eventually used for wear leveling, ensuing maximum longevity of the flash memory.

Whats the performance impact of wear leveling? 

Wear leveling is carried out as a background task to avoid impacting the read and write speed of the SSDs and NAND flash based storage systems. Different manufacturers may take slightly different approaches to wear leveling, which may have different affects on the performance or reliability of the overall system.

zurück