SSDs (solid state drives) offer benefits such as speed, low power consumption, durability, and low weight. SSDs have become as widely used as HDDs (hard disk drives). The difference between HDDs and SSDs is how they manage data. This task is more complicated on SSDs than HDDs. With proper management, SSDs are fast and have a long endurance over the life of the drive.
NAND (NOT-AND Gate) basic operation
It is not possible to read or write single NAND-flash cells individually. Data needs to be grouped and accessed with very specific properties. The following are the read, write, and erase properties of SSDs:
1. Reads aligned on page 1 can only request 1 byte from the operating system, but a full page will be retrieved in the SSD, forcing a lot more data to be read than necessary.
2. Writes align on pages. When writing data to SSD, writes happen by increments of the page size. Even if a write operation affects only one byte, an entire page needs to write to the flash.
How to write data to a page:
a. The data in blue shows data writes.
b. New data in yellow adds to the block. The blue data must also update. Because it can’t be overwritten, it must be written again, and the original data is marked as invalid.
c. This process repeats every time the blue data receives an update.
3. Erases align on block sizes. The page operates read/write, but it is not possible to erase individual pages.It is only possible to erase the entire block at once.
Reads and writes can happen at the page level, but erase (delete) can only happen at the block level. Users can read or write any number of pages from a block or to a block, but if a user wants to erase any part of that block, the drive must erase the block.
Properties of erase operations on SSDs
a. All pages are empty
b. Data is written
c. The block is full
d. Data is marked as invalid. Valid data not marked for deletion gets combined with new data. The new combined group “moves.” Here, “good data” not marked as invalid is rewritten from the blue block and the green block to an empty block with available pages
e. The valid data writes to another block. All the data in the block can be marked as invalid
f. All the data in a block has been cleared, it can be reused
Flash Translation Layer (FTL)
SSDs use the same host interfaces as a SATA (Serial ATA) interface. An additional component is required to hide the inner characteristics of NAND flash memory and expose only an array of LBAs (logical block addresses) to the host. This component is the FTL , and resides in the SSD controller. The FTL is critical and has two main purposes: logical block mapping and garbage collection.
Logical mapping
The logical block mapping translates LBAs from the host space into PBAs (physical block addresses) in the physical NAND-flash memory space. This mapping takes the form of a table, which gives the corresponding PBA for any LBA. This mapping table is stored in the cache of the SSD for faster access. It is saved in flash memory in case of power failure.
Garbage collection
The garbage collection process in the SSD controller ensures that “invalid” pages are erased and restored into a “free” state. This makes room for incoming write commands since pages cannot be partially written. If the data in a page has to be updated, the new data is written to a free page, and the page containing the previous data is marked as invalid. When blocks contain invalid pages, they need to be erased before they can be rewritten.
Summary
SSD operations are limited by features of NAND Flash:
1. Write operations must be in the unit of a page, and cannot overwrite the original content of the page.
2. Erasing data must be at the block level due to physical limitation.