How to keep SquashFS from imploding on NAND flash?

2015.02.19 12:15

I do a lot of embedded Linux work and generally enjoy the privilege of working with SquashFS and NOR flash. SquashFS is a performant read-only compressed file systems that makes shipping Linux on small flash chips possible. NOR flash is a less storage dense but "easy" flash technology to use in industrial settings; I cannot recall encountering 1 bad block on freshly shipped NOR flash.

However NAND flash is a different story; to make prices more competitive the manufacturer pretty much guarantees some blocks will be bad. The simple solution to reading and writing these bad blocks is to skip over them. (Obviously this breaks the "random access" guarantees marketers sell us on flash, but we will not go into details). Most software layers will do this; SquashFS apparently never will. So it is 2015 and the question we start with is:

How do we store a SquashFS image on NAND flash?

Ouch, any question beginning with "How" or "Why" is heavily open ended. Clearly we've got to break this down into a series of simple questions.

References

Keep updated with new posts: or follow on the Twitter feed