Longevity of USB Flash and Wear Leveling
I think we have all heard a USB can only be used so many times. Some say the number is 1,000 writes – some say the number is 100,000 writes. One thing I do know for sure, it’s impossible to tell on any one specific device. The life cycle of a USB is directly related to the flash memory…and from model to model or style to style, who knows what quality of flash is used. With that said, we can still explain the theory behind making USB drives last longer. For the most part it boils down to several elements A) the memory type and quality and B) the wear leveling technique.
As a quick summary the NAND flash in USB can be either SLC, MLC or TLC (single cell, multi-layer cell or triple-layer cell memory). Typically you will find MLC and now mostly TLC in USB sticks. SLC can be found but typically on the very high end devices.
Wear leveling is a technique to prolong the life of the erasable flash memory. To summarize, flash memory has individual, erasable segments that can be set as zero’s or ones (set as either positive or negative charge). However, after a certain number of erase and write cycles the segment (cell) becomes too unstable for reliable use.
Wear leveling is the algorithm used by the controller on the device which attempts to arrange the erase and writes evenly across the flash medium. Typically flash can have a cycle between 3,000 and 5,000 erase/writes. In addition to the usable area, the flash also has some cells with specific blocks for extended live which can handle up to 100,000 writes. This is the area where the controller makes not of the segments previously used and maps out the next best cells to use during an erase/write cycle.
There are three types of wear leveling.
No wear leveling – A Flash memory storage system with no wear leveling will not last very long if it is writing data to the flash. Without wear leveling, the Flash controller must permanently assign the logical addresses from the host computer to the physical addresses of the Flash memory. This means that every write to a previously written block must first be read, erased, modified, and re-written to the same location. This is very time consuming and highly written locations will wear out quickly with other locations even being completely unused. Once a few blocks reach their end of life the drive is no longer operable.
Dynamic wear leveling – The first developed type of leveling is called dynamic wear leveling and it uses a map to linklogicl block addresses from the host to the physical Flash memory. Each time the host writes replacement data, the map is updated so the original physical block is marked as invalid data, and a new block is linked to that map entry. Each time a block of data is re-written to the Flash memory it is written to a new location.
Static wear leveling – The other type of wear leveling is called static wear leveling which also uses a map to link the block addresses to physical memory addresses. Static wear leveling works the same as dynamic wear leveling except the static blocks that do not change are periodically moved so that these low usage cells are able to be used by other data. This rotational effect of block addressing enables an SSD to operate until most of the blocks are near their end of life.
The above are three types of wear leveling and there are three types of techniques used to extend the life of a USB drive.
Error correction – Code which is kept and logs bad blocks so they cannot be used again in future writes.
Pool reserve – Where if a write fails to a block it can be re-routed to the pool of reserved blocks and written there.
Track usage – Blocks on the media can be tracked in a least recently used queue of some sort. The data structures for the queue itself must be wear leveled as well as this queue information is constantly changing.
Source: Wikipedia and Nexcopy Inc. duplicator manufacturer.
Tags: flash, memory, wear leveling