Garbage Collection

GC is the storage capacity management mechanism for the main component of an SSD, i.e., the process of transferring the data stored at a particular Block to another Block of the NAND Flash while erasing non-useful data.
Garbage Collection 9
As NAND Flash is unable to overwrite previously stored and ineffective data, the original ineffective data in the Block must be erased before new data can be written in. However, the smallest write-in unit for NAND Flash is Page, and the minimum unit of erasure is Block; each Block contains 64 or 128 Pages, which means that data erasure is carried out by the Blocks. Garbage Collection 10GC simply duplicates the effective data from Blocks and integrates into another available Block when there is ineffective data required to be erased; therefore, the by-the-Block erasure can be carried out to form a Free Block. Garbage Collection 12If within Block X, there are data in the 6 Pages of A to F, if A, B, and C needs to be revised as A’, B’ and C’; the data in D, E, and F needs to be erased, then the SSD shall operate in the following manner:   Garbage Collection 14 (1) Save A’, B’, and C’ into the Free Page, while mark A, B, C, D, E, and F as Garbage (2) Then save A’, B’, and C’ in the free Page of Block Y (3) Execute Garbage Collect, and erase the entire Block X, and all Pages become Free Page. The objective of GC is to continuously clear out more free Blocks to maintain the write-in function of the SSD, as the more there are free Blocks, the faster the write-in speed will be. However, the P/E Cycle of NAND Flash Block has limits. If a single Block is subjected to constant write-in and erasure, there will be excessive wear and loss. This ultimately leads to decreased read-write speed, or worse, it may lead to damage, which results in a Bad Block.