Copyback
# Copyback

Copyback is a NAND flash memory or SSD operation where data is read from one location in flash memory and written to another location, usually in the same LUN. This data does not need to be sent to the host as the copyback operation does not originate from a read request. Copybacks are closely related to write amplification.

Copyback is part of the ONFI specification.

Copybacks are done for a variety of reasons:

* Garbage Collection: Data in flash memory cannot be over-written and must be erased before it can be re-written to. However in NAND flash, erases happen in at the block granularity and a block can have 16-128 pages, some of which may still contain valid data. If a block has valid data, it must be copied back before the block can be erased for reuse by the garbage collector.
* Wear Leveling: Wear Leveling sometimes requires data to be internally moved from one block to another to make use of a block with lower program/erase count.
* Errors: Data stored in flash memory can incur a variety of errors like retention errors, read-disturb and program-disturb errors which accumulate over time. If the total errors exceed the designed error correction capability, then data will be lost. Thus, the data has to be read, corrected and written somewhere else before the errors are too high.

The copyback operation can either be done by a read and then a write by the controller or as an NAND flash internal copyback operation. However, the internal copyback operation can lead to errors because NAND chips do not have error detection and correction inside them.

