NAND Flash/SSD Wear Leveling Algorithm
Flash Wear Leveling Can Add Years To An SSD
Flash memory in devices such as solid state drives (SSDs) is usually created from a combination of floating gate metal oxide semi-conductor field effect transistors (FGMOS) which is a big word to say that there are individual cells each of which can hold a specific amount of data. In the case of single level cell (SLC) nand flash the memory cell can be in one of two states allowing for the cell to represent for example a binary 1 or 0. Newer multi-level cell (MLC) nand can have 3 or more states allowing for more information within a single cell. Whichever, production method is chosen, however, it remains a fact that such cells can only handle a certain amount of write and erase cycles before their state becomes unreliable making it hard for firmware to determine what information is supposed to be stored in the degregated memory container.
For that reason wear leveling algorithms are generally implemented to distribute the workload of write and erase cycles evenly and in turn increase the longevity of the flash memory. The two main categories of wear levelling are dynamic and static. In essence, the dynamic wear leveling algorithm will only work on data that is active and being updated. Data that is rarely being changed such as operating system files will remain in place and not be subject to the algorithm. When the drive or flash module eventually wears out there could still remain a large area of memory that could be written to many times but the drive is effectively dead. The second type is a static wear levelling approach. In that case, if the firmware algorithm notices that say there are files not being updated much (Windows dll libraries or something similar perhaps) then the stagnant data will still be moved at some point to utilize the cells so that they just won't be written to once and forgotten about. This is a wide area of research with companies developing proprietary algorithms for various uses and it is an important design decision in the development process of a solid state drive. Dynamic algorithms generally offer faster performance while delivering a shorter lifespan and for that reason can be more commonly found in usb flash thumbdrives where lifespan may not be as much of an issue. Static algorithms, on the other hand, can extend a products lifespan usually at the expense of some speed. It is a tradeoff in flash memory systems and worth considering when considering purchasing options.
Further complicating matters is the fact that many filesystems are not optimized for flash memory and as such may produce many unnecessary write cycles as opposed to a dedicated flash file system. For example, Window's commonplace NTFS file system may rewrite directory and other structures many times whereas flash file systems like JFFS2 and LogFs go a ways toward solving these negative consequences. Otherwise things must take place in the flash transition layer which acts as a go-between for the operating system and underlying file system.
These wear leveling algorithm have repercussions extending farther than just increasing device longevity. For example, USB flash drives can retain data despite being formatted or wiped due to the mechanism of the wear leveling firmware. It is a common avenue used by forensic investigators to retrieve data that a suspect may have wiped before or during an investigation. Some newer model usb devices are incorporating garbage collection and self-healing features which can sometimes increase the randomness and complicate recovery but that cannot be relied on. The best method of security remains to use a full encryption system and a self-destruction feature like that found in the Ironkey Enterprise which has a remote deny, disable, or destroy feature along with other military-grade necessities.