Wear leveling

Short description: Operating principle for certain storage media

Deep ruts from car wheels following the same path. Repetitive use of memory cells leads to a similar effect. Wear leveling attempts to distribute "traffic" more evenly.

Wear leveling (also written as wear levelling) is a technique[1] for prolonging the service life of some kinds of erasable computer storage media, such as flash memory, which is used in solid-state drives (SSDs) and USB flash drives, and phase-change memory.

Uneven wear on the central section of stairs, from pedestrians following a single path. Another everyday-life example of a similar issue.

The idea underpinning wear leveling is similar to changing position of car tires, avoiding repetitive load from being used on the same wheel. Wear leveling algorithms distribute writes more evenly across the entire device, so no block is used more often than others.

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.[2] However, HDDs generally are not wear-leveled devices in the context of this article.

## Contents

* 1 Rationale
* 2 Types
* 2.1 No wear leveling
* 2.2 Dynamic wear leveling
* 2.3 Static wear leveling
* 2.4 Global wear leveling
* 2.5 Comparison
* 3 Techniques
* 4 See also
* 5 References
* 6 External links

## Rationale

EEPROM and flash memory media have individually erasable segments, each of which can be put through a limited number of erase cycles before becoming unreliable. This is usually around 3,000/5,000 cycles[3][4] but many flash devices have one block with a specially extended life of 100,000+ cycles that can be used by the flash memory controller to track wear and movement of data across segments.[citation needed] Erasable optical media such as CD-RW and DVD-RW are rated at up to 1,000 cycles (100,000 cycles for DVD-RAM media).

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.[5] 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.[6][7]

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.[8]

## Types

There are several wear leveling mechanisms that provide varying levels of longevity enhancement in such memory systems.[9][6]

### 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.[9]

### Dynamic wear leveling

The first type of wear leveling is called dynamic wear leveling and it uses a map to link logical block addresses (LBAs) from the OS to the physical flash memory. Each time the OS 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. However, flash memory blocks that never get replacement data would sustain no additional wear, thus the name comes only from the dynamic data being recycled. Such a device may last longer than one with no wear leveling, but there are blocks still remaining as active even though the device is no longer operable.[9][6]

### 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.[9][6]

### 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:[6]

Item  | Static  | Dynamic

|
|

Endurance  | Longer life expectancy  | Shorter life expectancy
Performance  | Slower  | Faster
Design complexity  | More complex  | Less complex
Typical use  | SSDs,[9]
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 overprovisioned 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 least frequently used (LFU) queue. The data structures for the queue itself must either be stored off-device or in such a way that the space it uses is itself wear-leveled or, in the case of flash memory, in a block with a specially extended life. However, usual 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 Secure Digital cards and USB flash drives,[12] techniques are implemented in hardware by a built-in microcontroller. On such devices, wear leveling is transparent, and conventional file system such as FAT can be used on them as-is.

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

* Flash file system
* Battery balancing

## References

1. ↑ U.S. Patent 6,850,443 Wear leveling techniques for flash memory systems.
2. ↑ "Western Digital AV Hard Drive Product Information". Western Digital. http://wdc.com/en/products/products.asp?driveid=285.
3. ↑ "So you wanna buy a SSD? Read this first.". 10 January 2011. https://hardwarecanucks.com/forum/threads/so-you-wanna-buy-a-ssd-read-this-first.39762/.
4. ↑ "SSDs Shifting to 25nm NAND - What You Need to Know | StorageReview.com - Storage Reviews". February 12, 2011. https://www.storagereview.com/ssds_shifting_to_25nm_nand_what_you_need_to_know.
5. ↑ "Algorithms and data structures for flash memories", E. Gal, and S. Toledo, ACM Computing Surveys, 2005
6. ↑ 6.0 6.1 6.2 6.3 6.4 "USB Flash Wear-Leveling and Life Span". Corsair. June 2007. http://www.corsair.com/_faq/FAQ_flash_drive_wear_leveling.pdf.
7. ↑ Arnd Bergmann (2011-02-18). "Optimizing Linux with cheap flash drives". LWN.net. https://lwn.net/Articles/428584/.
8. ↑ Jonathan Corbet (2007-08-08). "Once upon atime". LWN.net. https://lwn.net/Articles/244829/.
9. ↑ 9.0 9.1 9.2 9.3 9.4 Perdue, Ken (2010-04-30). "Wear Leveling Application Note". Spansion. http://www.eettaiwan.com/STATIC/PDF/200808/EETOL_2008IIC_Spansion_AN_13.pdf.
10. ↑ "Wear Leveling". https://www.transcend-info.com/Embedded/Essay-22.
11. ↑ Wear Leveling – Static, Dynamic and Global. p. 5. https://www.cactus-tech.com/wp-content/uploads/2019/03/Wear-Leveling-Static-Dynamic-Global.pdf. Retrieved 20 November 2019.
12. ↑ 12.0 12.1 "Swissbit Industrial SD Memory Cards". Mouser Electronics. http://eu.mouser.com/new/Swissbit/swissbit-industrial-SD-memory/.
13. ↑ Qing Yang (2012-02-25). "Why Standard Cache Algorithms Won't Work For SSDs". velobit.com. http://www.velobit.com/storage-performance-blog/bid/118134/Why-Standard-Cache-Algorithms-Won-t-Work-For-SSDs.

## External links

* Flash SSDs - Inferior Technology or Closet Superstar?, bitmicro.com, archived from the original on February 2, 2007

* v
* t
* e

Solid-state drives

Key terminology|

* Encryption
* ECC
* Flash file system
* Flash memory
* SLC/MLC
* Flash memory controller
* Garbage collection
* IOPS
* MB/s
* Memory wear
* Open-channel SSD
* Over-provisioning
* Read disturb
* Secure erase
* Solid-state storage
* Trim command
* Wear leveling
* Write amplification

Flash manufacturers|

* Intel
* Micron
* Samsung
* SK hynix
* Flash Forward (joint venture between SanDisk and Kioxia)

Controllers|

| Captive|

* Western Digital
* SanDisk
* Fusion-io
* HGST
* sTec
* Intel
* Kioxia
* OCZ
* Indilinx (bankrupt, assets sold to Toshiba, which later spun off its SSD and flash business to Kioxia)
* Micron
* Samsung
* Seagate
* SandForce
* FADU

|

Independent|

* Greenliant Systems
* Maxiotek
* Marvell
* Phison
* PMC-Sierra
* SMI

SSD manufacturers|

* List of solid-state drive manufacturers

Interfaces|

* Advanced Host Controller Interface (AHCI)
* Fibre Channel (FC)
* NVM Express (NVMe)
* PCI Express (PCIe)
* SATA Express
* Serial ATA (SATA)
* Serial attached SCSI (SAS)
* Universal Serial Bus (USB)

Configurations|

* HDD form factors
* mSATA
* M.2
* PCI Express expansion card
* Thunderbolt
* USB Type-C
* Mini DisplayPort
* U.2
* EDSFF

Related organizations|

* INCITS
* JEDEC / JC-42, JC-64.8
* ONFI
* NVMHCI Work Group
* USB-IF
* SATA-IO
* SFF Committee
* SNIA
* SSSI
* T10/SCSI
* T11/FC
* T13/ATA

* Category

de:Wear-Leveling

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Wear leveling. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Wear_leveling&oldid=3900660"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template