Erase Block
Flash can be programmed a page at a time and erased only a block at a time, and a block is at least thirty-two pages because the standard says so. A page that has been programmed cannot be programmed again until it has been erased, and it cannot be erased without erasing everything around it. So changing one byte where it sits means reading a whole block out, erasing it, and writing all of it back: at a hundred and twenty-eight pages of sixteen kilobytes, two megabytes of writing to change one byte. No drive does that. It writes the new page somewhere already empty and marks the old one dead, which costs nothing until the space has to be recovered, and then it costs whatever the block being reclaimed still has alive in it.
New to how flash is written? Start here
A flash cell holds charge on a gate that is insulated on every side, which is why it keeps its value with the power off. Putting charge on is programming and takes charge off is erasing, and the two are not symmetrical: programming can be done to a small group of cells, and erasing needs a much larger one because of how the voltage has to be applied.
So the chip has two units, and they are different sizes. A page is the unit that can be read and written. A block is many pages and is the unit that can be erased. A page that has been written cannot be written again until the block it sits in has been erased, and that single asymmetry is what this page is about.
Fast and forgetful, or slow and permanent
Memory is quick and loses everything when the power goes. A disk keeps what it was given and is slower by a factor with several zeroes in it. Parts that are both do exist and none has been cheap or plentiful: battery-backed memory modules are still made, and the fastest persistent part on the market was discontinued.
So nearly every design in this topic is buying one with the other. Keep it in the fast part and you are quick until the lights go out. Write it to the slow part first and you are safe but waiting. The machines here are the arrangements people found in between, and each of them is honest about which half it gave up.
The machine for this idea on its own is Write-Ahead Log, if you would rather press it than read about it.
The drive cannot overwrite the page you asked it to overwrite
1 The two granularities the standard defines, and the multiple of 32 between them
Flash has two granularities and they are not the same size, which is the whole of it. The ONFI specification defines them plainly: A page is the smallest addressable unit for read and program operations.
And A block is the smallest erasable unit of data within the Flash array of a LUN.
A page can be programmed once and cannot be un-programmed. Only a block can be erased, and the standard requires The number of pages per block shall be a multiple of 32.
| unit | size | what it is the smallest unit of |
|---|
2 One byte changed where it sits, which erases and rewrites everything around it
Now change one byte, in place, where it already is. The page holding it cannot be rewritten without an erase, and the erase takes the whole block, so every other page in that block has to be read out and written back. The byte you asked to change is the smallest part of what happens.
| step | amount |
|---|
3 The same byte written somewhere empty instead, and the bill that arrives at reclamation
So no drive does that. The new page is written somewhere already erased and the old one is marked dead, which costs nothing at the time. The bill arrives when a block has to be reclaimed to get free pages back, and what it costs depends entirely on how much of that block is still live: the live pages must be copied out before the erase, and only the dead ones become free space. Move the slider and watch the cost of a nearly full drive.
| quantity | value |
|---|
These ran in this browser when the page loaded. Each claim, whether it held, and the number behind it.
| claim | held | measured |
|---|---|---|
| the standard allows only block counts that are a multiple of 32 | yes | ONFI: the number of pages per block shall be a multiple of 32, so 32 and 128 are legal block sizes and 48 is not |
| and only page sizes that are a power of two | yes | ONFI: the number of user data bytes per page, not including the spare data area, shall be a power of two |
| changing one byte in place writes 2 MiB and erases a block | yes | 128 pages of 16384 bytes, because a page cannot be un-programmed and only a block can be erased |
| and the amplification is exactly the block size in pages, whatever the page size | yes | the page size cancels: it multiplies the bytes written and the bytes that had to be rewritten by the same factor |
| writing out of place and reclaiming a half-live block costs 2 writes for every one asked for | yes | reclaiming copies 64 pages and frees 64, so one copy buys one free page |
| and reclaiming a block with one dead page in it costs 128 for every one | yes | which is the whole reason a drive kept nearly full slows down, and why over-provisioning is sold as capacity you do not get |
| a block with nothing dead in it cannot be reclaimed at all, and the model says so rather than dividing by zero | yes | erasing it would destroy live data, so there is no amplification to quote; the figure is absent rather than infinite |
What is real here, and what is not
The mechanism paper has NOT been read, and this says so
The NAND cell is Masuoka, Momodomi, Iwata and Shirota, IEDM 1987, pages 552 to 555, DOI 10.1109/IEDM.1987.191485. It is behind IEEE's paywall and no free copy was found: Semantic Scholar holds a catalogue entry rather than the document, IEEE Xplore answers a challenge page, and a search for a repository copy turned up textbook chapters that cite it rather than the paper. So it is cited for the mechanism and marked unread, and not one number on this page comes from it.
Every number here is from ONFI, which is free and was read
The two granularities, the multiple-of-32 rule and the power-of-two page size are all quoted from the ONFI specification, a published standard that anyone can download. That is why this page can be built at all without the 1987 paper: the mechanism explains why erasing works at block granularity, and the standard is what fixes the sizes the arithmetic needs.
The page size cancels, and the amplification is a count of pages
Changing one page in place costs a whole block whatever the page size is, because a larger page multiplies both the bytes written and the bytes that had to be rewritten by the same factor. So the honest figure is pages per block, and the byte totals here are that count multiplied out for scale rather than a second result.
One reclamation, not a drive
The last panel prices reclaiming a single block whose live pages you choose. A real drive picks which block to reclaim, and picking the deadest one is the whole art: greedy selection, wear levelling that deliberately picks a worse block to even out erase counts, and over-provisioning that keeps blocks from ever getting full. None of that is modelled. What is modelled is the arithmetic every one of those schemes is trying to escape.
No wear, no retention, no error correction
Blocks wear out after a bounded number of erase cycles, cells lose charge over time, and every real device runs error correction underneath all of this. None of it appears here. The page is about one ratio, and adding endurance figures would mean quoting vendor datasheets that disagree with each other, which is exactly what the source hierarchy exists to avoid.
Sources
- ONFI Workgroup, Open NAND Flash Interface Specification, Revision 3.1, September 2012. Section 1.4.1 for the definitions of page and block; the Flash array description for the block as smallest erasable unit, the power-of-two page size and the multiple-of-32 pages per block.
- Fujio Masuoka, Masaki Momodomi, Yoshihisa Iwata and Riichiro Shirota, New Ultra High Density EPROM and Flash EEPROM with NAND Structure Cell, IEDM Technical Digest, December 1987, pages 552 to 555. Cited for the NAND cell. NOT read: IEEE paywall, and no free copy found.
- Logical Art, the studio this belongs to.