Storage system in embedded system is differs with PC or server’s machine. There is no large-capacity storage like hard disk. Storage in embedded system is limited into some MB. Typical embedded system use flash memory rather than magnetic disk. The memory in general can be categorized as two types: NOR flash and NAND flash.
As described, filesystem in embedded system is usually so small in capacity. Therefore, a different approach used to maximize this capacity potential. In this article we will discuss about what filesystem supported by OpenWRT.
Note that, this article won’t discuss the filesystem too much. In future, there might be some link / reference / further reading for each filesystem.
Introduction: NOR vs NAND
Flash memory is an electronic non-volatile computer storage device that can be electrically erased and reprogrammed.
Flash memory technology is developed from EEPROM (Electrically Erasable Programmable Read-Only Memory). There are two types of Flash Memory: NOR flash and NAND flash, which describe the basic logic gates used.
NOR-type flash memory allows a single machine word / byte to be written or read independently.
NAND-type flash may be written and read in blocks (or pages). This operation is similar to disk process. In fact, NAND type is primaly used in main memory (RAM). Other than main memory, it also used to develop memory cards, USB flash drives and Solid State Drives.
The (mini fanout overlay file system) – Redirects modifying operations to a writable location called “storage directory”, and leaving the original data in the “base directory” untouched. When reading, the file system merges the modified and original data so that only the newest versions will appear.
On newer OpenWRT, the filesystem is obsoletes and replaced with overlayfs.
Read only compressed filesystem. The compression is useing LZMA. Data is not aligned, allowing SquashFS to pack the files tighter thus taking up significantly less space than JFFS2. The compression can save up 20-30% compared to JFFS2.
- Taking as little space as possible
- Allow the implementation of FailSafe for recovery.
- Read only, means no way to alteration. If alteration should be done, one should extract the data, make alteration and compress it to new SquashFS filesystem.
- Waste space, since each time a file contained on it is modified, actually a copy of it is being copied to the second partition (JFFS2).
Writable compressed filesystem with journaling and wear levelling using LZMA compression.
- writable, has journaling and wear leveling
- compressed, so program (opkg, for example) can’t know in advance how much space a package will occupy.
Old filesystem particularly used by Linux.
- Program can knows how much space is left
- no journaling
- no wear leveling
- no transparent compression
/tmp resides on a tmpfs and /var is a symlink to it. /dev resides on a little tmpfs partition of its own
- no wear leveling