- Traditional OS file systems are designed for mechanical disks.
- Allocate specific sectors.
- Minimize seek time.
- Flash storage is not much like mechanical disks.
- No head movement. Position is not usually relevant.
(Some have different times for even and odd blocks).
- Reading blocks are a bit larger than disk, 2K to 8K.
Reading is fast, near memory speed.
- Writing is done in much larger units, 32K or 64K. Writing is much slower,
though still faster than disk.
- Writing is done by first erasing, then writing the new data.
- Flash devices generally try to pretend its a standard drive to the
OS. Their controller presents them this way.
- A standard file system assigns blocks to files, and changes those
blocks when the file changes.
- 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.
- Any file that changes a lot will wear out the part of the flash where
it resides.
- Flash Translation Layer (FTL).
- The flash controller tries to even out write wear.
- Block are placed in a new location when written.
- The firmware keeps track of where everything is, and translates
the block number from the OS to where the data is now.
- 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.
- The block numbers used by the OS have no relation whatsoever to the
actual data location.
- Allocation.
- Generally, writes are commited to the drive in rotation.
- The block number used by the OS is associated with whatever location
comes next.
- When the same block number is written again, the old location is
marked free.
- Since hardware erase blocks are larger than OS sectors, the
firware buffers writes
until it is ready to fill one.
- 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.
- Flash units will typically include some SRAM to record the mapping info,
and buffer blocks to be written.
- Generally, the OS is not allowed to know the flash is a flash, and
optimize for that.
- Traditional O/S optimizations are useless or counterproductive.
- May include one extension to the standard disk interface: TRIM/UNMAP
allows the OS to tell the controller that a block
is unused.
- Embedded devices may allow their OS to see the flash.
- Perhaps GP OS's will have access in the future.
Cornwell, Michael, Anatomy of a Solid-state Drive.