What is Wear Leveling?

Wear leveling is a technique used by manufacturers to extend the lifespan of flash memory.

Brief background

With silicon based technology, everytime you use it, it ages a little. The more you use it, the more it ages. Till it gets to a point where it packs up and says, “I’m done”. I’m not doing this anymore, I’m retiring.

This is true for your display, LCDs, P-Oleds, AMOLED etc. Everytime you turn it on, the pixels that light up grow a little older and dimmer.

This is true for your battery, with every charge cycle, it wears out just a little. The more you charge, discharge and recharge, the faster it grows old.

This is true for your SoC as well. Some people who chose to overclock their SoC, as many are fond of doing without caring about heat mitigation, have seen their SoCs basically die on them.

This can also be said for flash storage. The more you use it, the older it gets.

This is generally known as wear and tear.

How does Flash Memory age?

Every time you save or write data (pictures, movies etc.) to your flash storage, it gets written to a memory cell. As with all digital data, it is saved in binary code or 1s and 0s.

An 8-bit data could be saved as 11001011. The memory cell will hold a positive electric charge to indicate 1 or hold a negative electric charge to indicate 0.

The memory cell will have to lose or gain charges several times over a life span. This is due to the user (or the SoC/OS) writing and deleting data.

After a certain number of reads and writes, it would get to a certain point where the memory cell will no longer be able to hold or lose a charge.

This is where the life of a flash storage ends.

Flash Memory lifespan

The lifespan of all flash storage are calculated in the number of reads and writes that it would allow safely.

When that number is reached, the storage becomes write protected, meaning that nothing can be saved to it.

All flash storage used in smartphones and SSDs are NAND flash.

The more times a cell is used for storage, the faster it will age.

Now let’s assume from the photo above that the flash only saves to the first three cells in each memory block…

What this means is that those cells will age very very quickly. Much quicker than the back three.

When those cells reach the max numbers of saves (writes), the entire flash will be locked. It doesn’t matter if the three cells at the back are still good or not.

Wear leveling

So in order to avoid this, most companies that make NAND flash storage for smartphones as well as SSDs for PCs like Westgate, Samsung etc. have a technique for extending the lifespan of the flash.

It’s called wear leveling.

This simply means that the memory controller should have an idea of the number of times that a cell has been written to.

If there are 3 memory cells:

  • Cell A – 7 writes
  • Cell B – 19 writes
  • Cell C – 0 writes

The memory controller will only save data to Cell A and Cell C until their number of saves level up to Cell B’s 19.

This is done to ensure that all the cells wear and tear at the same level. In this way, no cell would age too quickly and force the flash to get shut down.

Types of wear leveling

There’s three types of wear leveling. These are:

  1. Static
  2. Dynamic
  3. Global

These are the different methods that are used to extend the lifespan of your storage.

Pretty simple concept to understand and a very smart one too.


Please leave a comment if you have any difficulty and remember to:

Leave a Reply

Your email address will not be published. Required fields are marked *