Part 5 of 7 · 2 min read
Wear and endurance
Think of a notebook whose pages tear a little each time they are erased and rewritten. If the writer always uses the same page, it tears first and the notebook is lost. A careful writer spreads the use over all pages. The analogy stops in one place: a notebook shows its wear, while a drive hides the wear count inside the controller.
In plain words: Every erase wears a block. A block survives a limited number of program-erase cycles, for example a few thousand for common chips. When blocks wear out, the drive loses capacity and then fails. Wear leveling is the policy of spreading erases evenly over all blocks, and it sometimes moves cold data, which is data that is not rewritten, so that lightly used blocks also share the work. The total life is set by the number of cycles, the capacity, and the write amplification.
A worked example (made up to show the idea). A 512 GB drive has blocks that last 1,000 cycles, and the write amplification is 3. In total the chips can accept 512 GB x 1,000 = 512 TB of writes. The host can write 512 / 3 = 170.7 TB before they are used up. At 200 GB per day, that lasts 170.7 TB / 200 GB = 853 days, which is 2.3 years. If a better drive has a write amplification of 1.5, the same use lasts twice as long.
The key lines. The simulator of section 3 can also count erases for each block. Run with 25% spare, a version that counts them printed a minimum of 0 and a maximum of 122 erases per block. Some blocks were never erased while others were erased 122 times. A real drive adds a rule that moves cold data out of rarely erased blocks, to keep the spread narrow.
Wear leveling
Wear leveling is the policy in a flash drive that spreads program-erase cycles evenly over all blocks, so that no block wears out much sooner than the others. Static wear leveling also moves data that is never rewritten, so that its blocks join the pool of blocks that take new writes.
Example: a controller that sees one block with 122 erases and another with none swaps their roles by moving the cold data from the unused block.
Common mistake
Endurance is often quoted as a number of total bytes written (TBW), which is given for the host's writes. It already contains the effect of write amplification for a typical load. A load of tiny random writes can wear a drive faster than the quoted figure suggests.
Check yourself: 1. What does static wear leveling do that dynamic wear leveling does not? 2. In the worked example, how many years would the drive last if write amplification were 1.5? 3. Why does halving write amplification double the life?