Flash Storage
  1. Traditional OS file systems are designed for mechanical disks.
    1. Allocate specific sectors.
    2. Minimize seek time.
  2. Flash storage is not much like mechanical disks.
    1. No head movement. Position is not usually relevant. (Some have different times for even and odd blocks).
    2. Reading blocks are a bit larger than disk, 2K to 8K. Reading is fast, near memory speed.
    3. Writing is done in much larger units, 32K or 64K. Writing is much slower, though still faster than disk.
    4. Writing is done by first erasing, then writing the new data.
  3. Flash devices generally try to pretend its a standard drive to the OS. Their controller presents them this way.
    1. A standard file system assigns blocks to files, and changes those blocks when the file changes.
    2. That's a problem because erases wear out the section of the disk erased. Decay is slow, but usually each area is assumed to last 10,000 to 100,000 erase cycles.
    3. Any file that changes a lot will wear out the part of the flash where it resides.
  4. Flash Translation Layer (FTL).
    1. The flash controller tries to even out write wear.
    2. Block are placed in a new location when written.
    3. The firmware keeps track of where everything is, and translates the block number from the OS to where the data is now.
    4. The OS can repeatedly write to the same block number, it will be recorded in different places each time, but reading it will return the correct data.
    5. The block numbers used by the OS have no relation whatsoever to the actual data location.
  5. Allocation.
    1. Generally, writes are commited to the drive in rotation.
    2. The block number used by the OS is associated with whatever location comes next.
    3. When the same block number is written again, the old location is marked free.
    4. Since hardware erase blocks are larger than OS sectors, the firware buffers writes until it is ready to fill one.
    5. A garbage collector finds erase blocks which are mostly free, and moves the still-valid content to the front so the block can be reused.
  6. Flash units will typically include some SRAM to record the mapping info, and buffer blocks to be written.
  7. Generally, the OS is not allowed to know the flash is a flash, and optimize for that.
    1. Traditional O/S optimizations are useless or counterproductive.
    2. May include one extension to the standard disk interface: TRIM/UNMAP allows the OS to tell the controller that a block is unused.
    3. Embedded devices may allow their OS to see the flash.
    4. Perhaps GP OS's will have access in the future.

Cornwell, Michael, Anatomy of a Solid-state Drive.