scan-nand - OFW diagnostic tool for NAND filesystem
scan-nand is an Open Firmware command that shows a graphical representation of the NAND FLASH contents.
On an unsecured XO, just type
On a secured XO, hold the rocker pad in the up direction (gently, so you don't also activate other directions) while powering on - see Cheat codes.
Each block of the display shows the state of one NAND FLASH "erase block" (a 128 kilobyte chunk). The colors are:
- Green - The block contains JFFS2 filesystem data with a "summary node" at the end. This is the usual state for blocks that are in use.
- Blue - The block has been erased and marked with a "cleanmarker", indicating that it is available for use by JFFS2. On a freshly-installed system, there should be a fair number of blue blocks, perhaps half or more.
- Red - The block is known to be bad and has been marked as such so that system won't try to use it again. Some number of bad blocks - ten or so - is normal.
- Gray - The block contains a bad block table - a list of blocks known to be unusable. There will be a couple of these at the end (bottom right).
- Black - The block has been erased but does not have a "cleanmarker". If you have a large chunk of black blocks near the bottom, perhaps with no blue blocks at all, it means that a NAND FLASH update didn't complete (because the cleanmarkers - blue blocks - aren't written until the end of the update process).
- Yellow - The block has some JFFS2 nodes at the beginning, but doesn't have a summary node at the end. This can happen if the machine is shutdown uncleanly, so that JFFS2 doesn't get a chance to "close out" the block that it is working on. This usually doesn't cause problems, as JFFS2 can recover from that later. It's common to see a few yellow blocks in a system that has been used for awhile.
Some common patterns:
- Green at the top, blue at the bottom, a few reds here and there. This is what it looks like right after a fresh reinstallation.
- Like the above, but a few greens mixed in with the blues. This it what it looks like after you have booted Linux/Sugar several times. The randomly-located greens are places where JFFS2 put new data (the locations are randomized so as not to wear out NAND FLASH blocks).
- Lots of green, hardly any blue. Filesystem is nearly full.
- Random green and blue all over the place. Filesystem has been in use for a long time.
- Lots of black. If the black is grouped at the bottom, the filesystem was incompletely written initially. If the black blocks are in random places, something I don't understand has happened.
After scan-nand finishes, you can use the arrow keys to move around and see a message about the status of individual blocks. A small cursor surrounds the currently-selected block. That's useful if you forget what the colors mean, or if you need to find the block number for further analysis. Type ESC (upper left key) when you're done.