4.2.8. Memory Storage Devices

Similar to disks are various memory devices, based most notably on NOR and NAND types of FLASH memory chips. These memory chips retain their content even when powered off, but reading and writing them is generally slower and explicit erasing is required before writing. Erasing is only possible on whole blocks at a time. The NOR chips allow reading and writing arbitrary addresses. The NAND chips allow reading and writing whole pages at a time only. Blocks are typically tens to hundreds of kilobytes in size, pages are typically hundreds of bytes to kilobytes in size, all naturally powers of two.

The individual blocks of the memory chips wear down by erasures, with the typical lifetime ranging between tens of thousands and tens of millions of erasures. To make sure the wear is spread evenly across the entire device, block remapping is used to achieve wear levelling. Most memory storage devices that masquerade as disks support wear levelling in hardware.

Devices that masquerade as disks must mimic the ability to rewrite individual sectors. This requires block erasures that happen at different granularity than sector writes. Rewriting only some sectors of a block triggers copying of remaining sectors, leading to write amplification. Some controllers support a special trim command that marks a sector as unused. These sectors are not copied when their block is erased.