· real filesystems running on an emulated NOR flash at measuring
PALETTE

Flash Stats

1.0×Write amp
0%Garbage
0%Programmed
0Pages blank
0 msFlash time
0Erases
0Files
0 KBLive data
0Live sectors
0Reads
0Peak wear

Sector inspector

Click a sector to inspect it.
POKE
› ↑ history · enter

About FLASHVIS

FLASHVIS runs real embedded filesystems, compiled to WebAssembly, against an emulated NOR flash chip that lets you see where the data ends up and where operations work. Every read, program, and erase lights up the die, so you can watch and compare how filesystems behave. It exists to show how FASTFFS, a new NOR flash filesystem, works next to others.

Hit Run to see it in action.

The filesystem cards in the header switch the view: click one to focus its die and compare the same workload on each.

You are looking at NOR flash - sectors and pages

The chip die visualization grid shows 256 KB of NOR flash: 64 sectors of 4 KB, each 16 pages of 256 bytes.

The larger squares are sectors, each cell inside is one 256 byte page, and its fill height is the bytes programmed. Past that physical fill, the die also tints pages by logical roles the filesystem assigns: live versus obsolete (which copy it still treats as current, not a physical byte state) and data versus metadata (file bytes versus the filesystem's own bookkeeping). The wear heatmap adds a third view, tinting each sector by how many times it has been erased, so you can watch for hotspots that might wear out early.

Two ways to drive it

Run starts the automated workload generator: it creates, replaces, and deletes files continuously to a roughly steady state of storage capacity, so you watch the die under a write heavy load. This is where most of the interesting action happens and where most of the divergent filesystem behavior occurs.

Step drives the automated workload generator one step at a time.

The console and the poke buttons (write, read, ls, delete, gc, format) drive one action at a time, so you can watch a single operation on the die. Or put in a one liner to run a micro-benchmark. Type help() for the full command list.

Least time, or most ops

This toggle switches how the various filesystems are kept in sync. Least time for equal ops (pace) holds every filesystem to the same workload step, so the die images stay directly comparable, and tracks each one's active flash time: the same work, timed. Most ops in equal time (race) lets each filesystem run as fast as it can and counts how far it gets: equal time, more work.

Switching modes will cause them to catch up using the new mode.

NOR flash has a few peculiarities:

  • Erased data reads as 0xFF.
  • Programming only clears bits from 1 to 0, down to a byte at a time. You can keep programming 1 bits into 0s without erasing.
  • Setting bits back to 1 takes an erase, and erase only works on a whole 4 KB sector. It is the slowest operation, and wears out the flash over time.
  • Most NOR flash chips are rated for 100,000 program/erase cycles per sector. Some flash, like the flash inside a microcontroller, might be rated for 10,000 or 1,000 cycles.

Timing is based on measured performance using an ESP32-S3, and is used both for flash time accounting and relative visual animation speeds: a 256 byte read is about 0.1 ms, a page program is about 1.5 ms, and a sector erase is about 21 ms. The speed control scales this simulated flash time so you can watch it in super slomo, or speed it up to see how it behaves over time.

How the filesystems cope

FLASHVIS compares five filesystems today: FASTFFS, LittleFS, SPIFFS, JesFS, and ChaN FatFs over the ESP-IDF wear_levelling FTL (shown as FAT+WL), with more planned. The first four are purpose-built for raw flash: they write new data into erased space and let superseded copies linger as garbage to reclaim later, since flash cannot cheaply overwrite in place. FatFs is the outlier, a classic overwrite-in-place FAT filesystem that only runs on flash because a wear-levelling translation layer beneath it remaps and rotates sectors to imitate a rewritable disk.

What they share

  • Bounded RAM/ROM. All five are built to run in a small, fixed amount of memory. RAM usage is strictly bounded and can be backed by statically provided buffers, so consumption does not grow as the volume fills.
  • Wear leveling. All five spread erases across the die so no one sector wears out early. The four flash-native designs rotate their own allocation (and GC) cursors; FatFs leans entirely on the wear_levelling layer beneath it to remap and rotate physical sectors.
  • Power-loss behavior is where they diverge. FASTFFS and LittleFS are fully copy-on-write and fall back to the last known good state after an interrupted write. The log-structured SPIFFS and chain-structured JesFS recover their committed files on remount. FatFs overwrites in place, so a write cut short, for example by a full volume, can leave a file truncated.

FASTFFS

The core idea is simple: file data is written copy-on-write into flash sectors, then a compact append-only index record (4 bytes) commits the namespace update. On remount, the index is replayed to recover the current set of names and where they start. Old file versions and interrupted writes are left as obsolete or orphaned data for later cleanup.

Within a sector, file metadata is appended to the tail, growing backwards, while file data (including the name) grows from the start of the sector down. This allows many smaller files to share a sector efficiently. When a file is deleted/overwritten it is marked obsolete, leaving any other live files in place and intact.

Its garbage collector is incremental, reclaiming in small cheap background steps that keep garbage low for a small, steady cost. The background GC control sets how often this runs during the automatic workload, but typically this would happen in the background while the application using FASTFFS is idle. It will still reclaim inline when free (erased, usable) space runs tight. It levels wear through two round-robin cursors: one for GC and one for alloc.

Compaction triggers on write allocation pressure when there is nowhere free/erased to write to, and no sector can be erased because they still have live data. It copies out live files (or parts of them) that are trapping the most obsolete/reclaimable space, so that sectors can be erased and reused. This is only done when necessary, since it is expensive and causes write amplification.

LittleFS

At a high level, LittleFS is a block based filesystem that uses small logs to store metadata and larger copy-on-write (COW) structures to store file data.

In LittleFS, these ingredients form a sort of two-layered cake, with the small logs (called metadata pairs) providing fast updates to metadata anywhere on storage, while the COW structures store file data compactly.

Small files (under 1/4th of a sector, or 1KB) are stored directly in the metadata pairs. Files over that threshold are stored in one or more whole sectors.

It reclaims space as part of its writes rather than in a background operation. It has no incremental GC step to drive, so the background GC control does not appear when LittleFS is focused. It does have a GC function, but it does not reclaim space and is very expensive, so it is not used here out of fairness.

SPIFFS

SPIFFS is log-structured at a 256-byte page granule, the same size as one die cell, so its native map lines up one-to-one with the grid. Every 4 KB block begins with an object-lookup table: a compact array with one entry per data page in the block, recording which object that page belongs to. That table is SPIFFS's metadata and its liveness model in one.

Deleting or replacing a file erases nothing right away; it programs the page's lookup entry to a deleted marker (0x0000, since programming only clears bits to 0), leaving the page as garbage that lingers until its whole block is dead. Like FASTFFS, SPIFFS then reclaims in bounded background steps: a quick pass erases one block whose pages are all deleted, moving nothing. Because that step is small and churn-safe, SPIFFS is the other filesystem the background GC control drives. Turn it up and SPIFFS tidies more often between writes, just like FASTFFS. It also reclaims inline when free space runs tight.

JesFS

JesFS organizes the chip as chains of 4 KB sectors. Sector 0 holds a master header plus the file index, an array of pointers to each file's start. A file's HEAD sector co-locates its metadata (name, length, CRC) with the first ~4 KB of its data; longer files chain into further data sectors. Every sector carries a 4-byte magic recording its state, which is exactly what the die coloring reads.

Deleting a file just rewrites those magics, the head to a deleted state and its data sectors to a to-delete state, without erasing. Reclamation is entirely inline and just-in-time: when a later write needs a fresh sector, the allocator sweeps forward (a rotating cursor that also levels wear) and erases the next to-delete sector right before reusing it. There is no separate GC pass, so the background GC control does nothing when JesFS is focused.

FAT+WL

FatFs is the classic FAT filesystem, here ChaN FatFs over the ESP-IDF wear_levelling FTL. FAT expects to overwrite sectors in place and does no erasing itself; it simply rewrites the FAT table and directory entries as files change. Flash cannot overwrite, so the wear_levelling layer beneath it does the real work: it remaps each logical sector to a physical one and rotates a spare dummy sector on every update, spreading repeated overwrites (including the constant FAT-table rewrites) across the die instead of hammering one spot.

That translation layer costs 4 of the 64 sectors. Its config, state, and dummy sectors show up as metadata on the die, leaving a 240 KB logical volume (about 224 KB usable as FAT12, 4 KB clusters, two FAT copies). Deleting a file frees its clusters in the FAT, but the old bytes stay on the die as garbage until something reuses them; nothing reclaims proactively, so the background GC control is inert here too.

The cost of overwrite-in-place is the headline. Driven through the same workload, FatFs produces far more erasing than the log-structured designs. And because FAT is not copy-on-write, a write interrupted by a full volume can leave a file truncated, where the log-structured filesystems fall back cleanly.