Flash memory provides fast, inexpensive and non-volatile storage, and has become an essential enabling technology for a huge array of electronic devices, like simple flash thumb drives and digital cameras. More recently, it’s made its way into data centers in tier-one solid state drive (SSD) products.
But after repeated write cycles, flash memory cells wear out. To protect against that, manufacturers have developed wear-leveling techniques that distribute newly written data evenly across the entire memory device—and make sure that data isn’t corrupted or lost.
The Problem with Flash
All of today’s flash memory cell designs suffer from a limited number of write cycles. Saving new data involves changing the bit pattern in a flash memory device, which first requires the bits to be zeroed and then rewritten with new data bits. Each write cycle puts stress on the physical memory cells.
After about 5,000 write cycles (depending on the design and manufacture of the flash memory), the physical memory cells can become unreliable. This wear can compromise the file data in the afflicted cells, and the memory simply wears out. (Such wear is common to reprogrammable memory devices but does not affect traditional dynamic random access memory [DRAM] designs, which are constantly refreshed and rewritten.)
And limited life is just part of the flash story. Flash memory is almost always used to emulate disk space, and most file systems (such as traditional FAT and more recent NTFS) often rewrite data to the same places. This isn’t a problem for magnetic media like disk drives or DRAM-based storage, but it can easily lead to premature failures for flash memory.
How Wear Leveling Works
Enter wear leveling. This technique uses an algorithm on a microcontroller within the flash device to track how flash memory space is used. That causes rewritten data to occur elsewhere within the memory each time, rather than constantly rewriting the same memory locations. In an ideal scenario, wear leveling will cause all the physical flash memory to be used once before starting to re-use the space again. In this way, the maximum number of flash memory cells experiences the minimum amount of wear, so the flash device will enjoy the longest possible working life. When the maximum number of rewrites is finally approached, the entire flash device will wear out.
All wear leveling starts by creating a map that connects the flash memory locations to storage locations that the operating system understands, usually logical block addresses (or LBAs). From there, two kinds of wear leveling are possible: dynamic and static.
In dynamic wear leveling, blocks of memory space that are updated with new data are written to new blocks of memory space. The algorithm updates the map to reflect these changes. The old blocks of memory space are simply marked as invalid and will not be re-used until there are no other available blocks left on the flash device. Any blocks of memory space that do not change will be left alone. The dynamic wear-leveling approach is straightforward and offers relatively fast performance. As a result, dynamic wear leveling is often seen on simpler flash devices such as USB drives.
Static wear leveling uses the same basic approach of mapping and moving changing data, but now the wear-leveling algorithm periodically moves the unchanged (or static) data as well. This allows data that changes more frequently to use fresher, lesser-used memory space that was previously occupied by static data. Since a more complex algorithm will move more data around the flash device, performance may be somewhat lower than dynamic wear leveling, but the improvements allow static wear leveling to provide better reliability. This is critical for enterprise-class flash devices like SSDs.
IT managers will need to select flash devices with wear leveling technologies that strike a critical balance between performance and operational reliability/working life. —Stephen J. Bigelow