Flash Storage Devices
SSD, MMC & SD
Linux
Storage
NOR & NAND
Generally come in two flavors:
- NOR
- Used to store firmware images on embedded devices
- Connected to the processor via address and data lines (like RAM)
- Can be eXecuted In Place (XIP) by a processor
- NAND
- Used for solid-state mass storage media (USB sticks, SD cards)
- Large, dense, cheap, but imperfect storage
- Interfaces uses IO and control lines
- Has to be copied to RAM before execution
- Requires some sort of flash memory management
NAND typically presented to the system as ATA disk
- FTL (Flash Translation Layer)
- Handle all internal flash memory operations
- Presents illusion of ‘standard’ block device
- Logical to physical address mapping
- Block size translation
- Power off recovery
- Wear leveling (erase/write counts)
- Error correction (single/multi bit errors)
- Bad-block management (remap failing blocks)
- Write RAM buffer (tends to scale with price/size)
- Typically embedded in hardware (categorized as managed NAND)
NAND characteristics:
- Erased in blocks at a time, before re-write is possible
- Erase blocks are divided into pages (for example 64 per erase block)
- Pages usually a multiple of 512 bytes
- “Spare area” bytes used to store meta data (i.e. worn out marker, ECC data)
- Usually has bad blocks already when leaving the factory (to save costs)
Flash memory is unreliable:
- Data stored as probabilistic approximations
- Workaround: computational error correction (ECC)
Contain an internal controller
SSD
Storage
Memory cells…
- SLC (Single Level Cell)…1 Bit per memory cell
- Write/erase 100ns…100,000 cycles
- Low density…higher cost…more endurance
- MLC (Multi Level Cell)…2 Bits per memory cell
- Write/erase 120ns…10,000 cycles
- Medium denisty…less cost…less endurance
- TLC (Triple Level Cell)…3 Bits per memory cell
- 16LC (16 Level Cell)…4 Bits per memory cell
Layout…
- Pages…multiple memory cells
- …smallest structure is one page
- …can be read/written
- Blocks…multiple pages
- …smallest structure than can be erased
- 512 KB block…128x pages each 16.384 cells MLC (4KB)
- Planes…multiple blocks
- Dies…multiple planes
- TSOP (Thin Small Outline Package)
- …multiple dies (typically two)
- …device build from multiple TSOPs
Endurance
Sparse area…
- 7% to 25% of net capacity
- Cells have limited erase cycles..erase before overwrite required
- Wear leveling…
- …wear-out distributed over all cells
- …bad block replacement from sparse area
- Bad blocks…
- …fails to erase…
- …controller keeps track and replaces…
- …as long there is enough capacity
- Write errors…
- RBER (Raw Bit Error Rate)…
- …increase over time by cell aging
- …repaired buy ECC
- UBER (Uncorrectable Bit Error Rate)
- …should stay very low
- …errors <1 for every 10^15 accesses
MMC & eMMC
MMC (MultiMedia Card)
- Non-volatile, removable, portable flash (NAND) base storage
- Developed by Joint Electron Device Engineering Council (JEDEC)
- SD (Secure digital) cards are an improvement to MMC
eMMC (Embedded MultiMedia Card)
- Not removable
- Optimized for low cost, low power, small form factor
- Typically single silicon dye for controller, interface, and memory
UFS (Universal Flash Storage)…meant to replace SD cards and eMMCs
SD Cards
SD Card (Secure Digital Card)
- Non-volatile memory for consumer hand-held and portable electronics
- Based on MMC (Multi Media Cars), adding more features
- SD Specifications is controlled by the SD Card Association
Dimensions:
- Standard 32x24mm (2g)
- Mini 21x20mm (800mg)
- Micro 15x11mm (250mg)
Families | Size | Description |
---|---|---|
SDSC | 1 MB to 2 GB | Standard-Capacity |
SDHC | 2 GB to 32 GB | High-Capacity |
SDXC | 32 GB to 2 TB | eXtended-Capacity |
SDUC | 2 TB to 128 TB | Ultra-Capacity |
Speed classes: U1,U3 (10/30 MB/s) - V{1,3,6,9}0 MB/s
Bus | Speed max. | Spec |
---|---|---|
UHS-I | ≤ 104MB/s | 3.01 |
UHS-II | ≤ 312MB/s | 4.0 |
UHS-III | ≤ 624MB/s | 6.0 |
Express | ≤ 985MB/s | 7.0 |
Vendors: SanDisk, Samsung, Lexar, Kingston, Toshiba
Model | Read MB/s | Write MB/s | Size GB |
---|---|---|---|
SanDisk Extrem PRO | <275 | <100 | 64,128 |
Lexar 1800x | <270 | <150 | 64,128 |
Toshiba M502 | <270 | <150 | 16,32,64 |
SanDisk Extrem PLUS | <170 | <90 | 32,64,128,256,400,512 |
SanDisk Extrem | <160 | <90 | 32,64,128,256,400,512 |
Lexar 1000x | <150 | <90 | 32,64,128,256 |
Samsung EVO Plus | <100 | <90 | 32,64,128,256,512 |
Samsung EVO Select | <100 | <90 | 32,64,128,256,512 |
Kingston Canvas React | <100 | <80 | 32,64,128,256,512 |
Lexar 633x | <100 | <70 | 16,32,64,128,256,512 |
Samsung PRO Endurance | <100 | <30 | 32,64,128 |
SanDisk Ultra PLUS | <100 | 16,32,64,128,256,512 | |
Samsung EVO | <100 | 32,64,128,256 | |
Toshiba M402 | <95 | <95 | 16,32,64,128 |
Toshiba M401 | <95 | <80 | 16,32,64 |
Toshiba M303 | <95 | <65 | 64,128,256 |
Toshiba M302 | <90 | 16,32,64,128 | |
Kingston Canvas Go | <90 | <45 | 32,64,128 |
SanDisk Ultra | <80 | 16,32,64 | |
Kingston Canvas Select | <80 | <10 | 16,32,64,128,256 |
Lexar 300x | <45 | <45 | 16,32,65 |
/dev/mmc*
SD cards almost always pre-formatted, typically FAT32 of exFAT (on SDXC cards)
- Most controllers optimises for FAT
- First partition starts on an erase boundary (segment-aligned)
Potential file-systems to use on MMC devices
- FAT (default on SD cards)
- Lacks features of modern file-systems
- F2FS (Flash Friendly File-System)
- Create by Samsung, integrated into the Linux kernel (2013)
- Aims to create a NAND flash aware file-system
- Atomic operations, defragmentation, TRIM support
Supported in Linux though the mmc subsystem
- Code located in
drivers/mmc
and headers ininclude/linux/mmc/
- Block device
/dev/mmc*
# delete a DOS/MBR boot sector
dd if=/dev/zero bs=512 count=1 of=/dev/mmcblk0
# write a new boot sector
parted /dev/mmcblk0 mklabel msdos
# create a new partition
parted -a optimal /dev/mmcblk0 mkpart primary 0% 100%
# write a FAT32 file-system
mkfs.fat -F 32 /dev/mmcblk0p1
# mount the device
pmount /dev/mmcblk0p1 flash && ls /media/flash