Wear leveling
Wear leveling (also written as wear levelling) is a technique
The term preemptive wear leveling (PWL) has been used by Western Digital to describe their preservation technique used on hard disk drives (HDDs) designed for storing audio and video data.[4] However, HDDs generally are not wear-leveled devices in the context of this article.
Rationale
Wear leveling attempts to work around these limitations by arranging data so that erasures and re-writes are distributed evenly across the medium. In this way, no single erase block prematurely fails due to a high concentration of write cycles.[7] In flash memory, a single block on the chip is designed for longer life than the others so that the memory controller can store operational data with less chance of its corruption.[3][8]
Conventional file systems such as FAT, UFS, HFS/HFS+, EXT, and NTFS were originally designed for magnetic disks and as such rewrite many of their data structures (such as their directories) repeatedly to the same area. When these systems are used on flash memory media, this becomes a problem. The problem is aggravated by the fact that some file systems track last-access times, which can lead to file metadata being constantly rewritten in-place.[9]
Types
There are three basic types of wear leveling mechanisms used in flash memory storage devices:[2]
No wear leveling
A flash memory storage system with no wear leveling will not last very long if data is written to the flash. Without wear leveling, the underlying flash controller must permanently assign the logical addresses from the operating system (OS) 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 approach is very time-consuming and frequently written locations will wear out quickly, while other locations will not be used at all. Once a few blocks reach their end of life, such a device becomes inoperable.[2]
Dynamic wear leveling
The first type of wear leveling is called dynamic wear leveling and it uses a map to link
Static wear leveling
The other type of wear leveling is called static wear leveling which also uses a map to link the LBA 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 enables an SSD to continue to operate until most of the blocks are near their end of life.[2][3]
Global wear leveling
Both dynamic and static wear leveling are implemented at the local level. This simply means that in a multi-chip product, every chip is managed as a single resource. The number of defective blocks in different chips within a NAND flash memory varies: a given chip could have all its data blocks worn out while another chip in the same device could have all its blocks still active. Global wear leveling addresses this problem by managing all blocks from all chips in the flash memory together―in a single pool. It ensures that all the cells in all the chips within the product are worn out evenly. [10][11]
Comparison
The following table compares static and dynamic wear leveling:[3]
Item | Static | Dynamic |
---|---|---|
Endurance | Longer life expectancy | Shorter life expectancy |
Performance | Slower | Faster |
Design complexity | More complex | Less complex |
Typical use | SSDs,[2] industrial-grade flash drives[12] |
Consumer-grade flash drives |
Techniques
There are several techniques for extending the media life:
- A checksum or error-correcting code can be kept for each block or sector in order to detect errors or correct errors.
- A pool of reserve space can also be kept. When a block or sector does fail, future reads and writes to it can be redirected to a replacement in that pool.
- Blocks or sectors on the media can be tracked in a cache algorithms are designed to manage the data flow into and out of RAM-based caches, making them not directly suitable for flash-based storage devices as they have an asymmetrical nature – reads are usually much faster than writes, and erase operations can be performed only one "block" at a time.[13]
- Garbage collection
On
Wear leveling can also be implemented in software by special-purpose file systems such as JFFS2 and YAFFS on flash media or UDF on optical media. All three are log-structured file systems in that they treat their media as circular logs and write to them in sequential passes. File systems which implement copy-on-write strategies, such as ZFS, also implement a form of wear leveling.
See also
References
- ^ U.S. patent 6,850,443 Wear leveling techniques for flash memory systems.
- ^ a b c d e f Perdue, Ken (2010-04-30). "Wear Leveling Application Note" (PDF). Spansion. Archived from the original (PDF) on 2011-06-07. Retrieved 12 August 2010.
- ^ a b c d e "USB Flash Wear-Leveling and Life Span" (PDF). Corsair. June 2007. Archived from the original (PDF) on 13 October 2007. Retrieved 27 July 2013.
- ^ "Western Digital AV Hard Drive Product Information". Western Digital. Archived from the original on 2010-01-02. Retrieved 2010-06-01.
- ^ "So you wanna buy a SSD? Read this first". Hardware Canucks.
- ^ "SSDs Shifting to 25nm NAND - What You Need to Know | StorageReview.com - Storage Reviews". www.storagereview.com. February 12, 2011. Archived from the original on December 5, 2019. Retrieved December 5, 2019.
- ^ "Algorithms and data structures for flash memories", E. Gal, and S. Toledo, ACM Computing Surveys, 2005
- ^ Arnd Bergmann (2011-02-18). "Optimizing Linux with cheap flash drives". LWN.net. Retrieved 2013-10-03.
- ^ Jonathan Corbet (2007-08-08). "Once upon atime". LWN.net. Retrieved 2014-01-21.
- ^ "Wear Leveling". Transcend. Transcend. Retrieved 20 November 2019.
- ^ "Wear Leveling – Static, Dynamic and Global" (PDF). Cactus: 5. Retrieved 20 November 2019.
- ^ a b "Swissbit Industrial SD Memory Cards". Mouser Electronics. Retrieved 21 April 2017.
- ^ Qing Yang (2012-02-25). "Why Standard Cache Algorithms Won't Work For SSDs". velobit.com. Retrieved 2013-11-26.
External links
- Flash SSDs – Inferior Technology or Closet Superstar?, bitmicro.com, archived from the original on February 2, 2007