Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| docs:techref:filesystems [2018/02/20 18:51] – ↷ Page moved from doc:techref:filesystems to docs:techref:filesystems bobafetthotmail | docs:techref:filesystems [2024/03/09 03:22] (current) – [Filesystems] add link to intro palebloodsky | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Filesystems ====== | ====== Filesystems ====== | ||
| - | This article is about file systems | + | This article is about file systems |
| - | For general external support for installing file systems on other devices, including partitioning and mounting see [[docs: | + | |
| - | Please read about the -> [[flash.layout]] as well. Also, note that there are two types of flash memory: [[wp> | + | For installing additional file systems, including partitioning and mounting, see this page for [[docs: |
| + | |||
| + | Please read about the [[flash.layout]] as well. Also, note that there are two types of flash memory: [[wp> | ||
| ===== Common File System ===== | ===== Common File System ===== | ||
| ==== OverlayFS ==== | ==== OverlayFS ==== | ||
| - | Used to merge two filesystems, | + | Used to merge two filesystems, |
| + | * [[wp> | ||
| + | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| - | * http:// | + | * [[http:// |
| - | * was mainlined in Linux kernel 3.18, see [[https:// | + | * Was mainlined in Linux kernel 3.18 |
| - | * [[https:// | + | |
| * Overlayfs' | * Overlayfs' | ||
| + | |||
| ==== tmpfs ==== | ==== tmpfs ==== | ||
| - | * [[wp> | + | [[wp> |
| - | * ''/ | + | |
| - | * (+) no wear leveling | + | * [[https:// |
| + | |||
| + | * (+) doesn' | ||
| + | * (-) no wear leveling | ||
| * (-) volatile (doesn' | * (-) volatile (doesn' | ||
| - | * [[http:// | ||
| ==== SquashFS ==== | ==== SquashFS ==== | ||
| Line 27: | Line 32: | ||
| * (+) taking up as little space as possible | * (+) taking up as little space as possible | ||
| - | * (+) allowing the implementation of an idiot proof [[docs:user-guide: | + | * (+) allowing the implementation of an idiot proof [[docs: |
| * (-) read only | * (-) read only | ||
| * (-) waste space, since each time a file contained on it is modified, actually a copy of it is being copied to the second (JFFS2) partition | * (-) waste space, since each time a file contained on it is modified, actually a copy of it is being copied to the second (JFFS2) partition | ||
| - | * [[http://lxr.free-electrons.com/source/Documentation/ | + | * [[https://www.kernel.org/doc/html/latest/ |
| - | * [[http://tree.celinuxforum.org/CelfPubWiki/ | + | * [[https://elinux.org/Squash_Fs_Comparisons|SquashFs Performance Comparisons]] |
| - | + | ||
| - | There is a generic problem when running SquashFS on NAND: The issue is that SquashFS has no bad block management at all and requires all blocks on order; but for proper NAND bad block management you also need to be able to skip bad blocks and occasionally relocate blocks (see [[http:// | + | |
| + | There is a generic problem when running SquashFS on NAND: The issue is that SquashFS has no bad block management at all and requires all blocks on order; but for proper NAND bad block management you also need to be able to skip bad blocks and occasionally relocate blocks (see [[https:// | ||
| ==== JFFS2 ==== | ==== JFFS2 ==== | ||
| Line 41: | Line 45: | ||
| * (+) is writable, has journaling and wear leveling | * (+) is writable, has journaling and wear leveling | ||
| * (+) is cool | * (+) is cool | ||
| - | * (-) is compressed, so a program ('' | + | * (-) is compressed, so a program ('' |
| * (+) is compressed, so a program (which is preinstalled) takes much less space, so effectively you have more space | * (+) is compressed, so a program (which is preinstalled) takes much less space, so effectively you have more space | ||
| + | |||
| + | For NAND-flash targets, it was replaced with UBIFS. | ||
| ==== UBIFS ==== | ==== UBIFS ==== | ||
| - | * [[wp> | + | * [[wp> |
| - | * [[http://lxr.free-electrons.com/source/Documentation/ | + | * [[https://www.kernel.org/doc/html/latest/ |
| - | * https:// | + | * [[https:// |
| - | * https:// | + | * [[https:// |
| - | * https:// | + | * [[https:// |
| * [[https:// | * [[https:// | ||
| + | |||
| ==== ext2 ===== | ==== ext2 ===== | ||
| * [[wp> | * [[wp> | ||
| * Ext2/3/4 is used on x86, x86-64 and for some arch with SD-card rootfs | * Ext2/3/4 is used on x86, x86-64 and for some arch with SD-card rootfs | ||
| - | * [[http://lxr.free-electrons.com/source/Documentation/ | + | * [[https://www.kernel.org/doc/html/latest/ |
| - | * (+) a program ('' | + | * (+) a program ('' |
| * (+) good ol' veteran FOSS file system | * (+) good ol' veteran FOSS file system | ||
| - | * (-) no journaling | + | * (-) no journaling |
| * (-) no wear leveling | * (-) no wear leveling | ||
| * (-) no transparent compression | * (-) no transparent compression | ||
| Line 64: | Line 71: | ||
| ===== Other filesystems ===== | ===== Other filesystems ===== | ||
| - | OpenWrt does not use other filesystems as rootfs. It supports several | + | OpenWrt does not use other filesystems as rootfs. It supports several |
| ==== mini_fo ==== | ==== mini_fo ==== | ||
| * was used by older OpenWrt version and thus there are still references to this in the Wiki | * was used by older OpenWrt version and thus there are still references to this in the Wiki | ||
| * replaced by [[# | * replaced by [[# | ||
| - | * [[https:// | + | * [[https:// |
| - | * [[http:// | + | * [[https:// |
| ===== Implementation in OpenWrt ===== | ===== Implementation in OpenWrt ===== | ||
| - | The [[doc:techref:Flash.Layout]] article documents how OpenWrt uses both SquashFS and JFFS2 filesystems combined into one filesystem by overlayfs. The kernel is also stored separately from these partitions in raw flash. When the kernel is built, it is also compressed with [[wp> | + | The [[docs:techref:flash.layout]] article documents how OpenWrt uses both SquashFS and JFFS2 filesystems combined into one filesystem by overlayfs. The kernel is also stored separately from these partitions in raw flash. When the kernel is built, it is also compressed with [[wp> |
| ==== Boot process ==== | ==== Boot process ==== | ||
| System bootup is as follows: -> | System bootup is as follows: -> | ||
| - | - kernel boots from a known raw partition (without a FS), scans mtd partition //rootfs// for a valid superblock and mounts the SquashFS partition (containing ''/ | + | - kernel boots from a known raw partition (without a FS), scans mtd partition //rootfs// for a valid superblock and mounts the SquashFS partition (containing ''/ |
| - ''/ | - ''/ | ||
| - '' | - '' | ||
| Line 95: | Line 102: | ||
| The fact that we pack things so tightly in flash means that if the firmware ever changes, the size and location of the JFFS2 partition also changes, potentially wiping out a large chunk of JFFS2 data and corrupting the filesystem. To deal with this, we've implemented a policy that after each reflash the JFFS2 data is reformatted. The trick to doing that is a special value, '' | The fact that we pack things so tightly in flash means that if the firmware ever changes, the size and location of the JFFS2 partition also changes, potentially wiping out a large chunk of JFFS2 data and corrupting the filesystem. To deal with this, we've implemented a policy that after each reflash the JFFS2 data is reformatted. The trick to doing that is a special value, '' | ||
| The fact that we use a combination of compressed and partially read only filesystems also has an interesting effect on package management: | The fact that we use a combination of compressed and partially read only filesystems also has an interesting effect on package management: | ||
| - | In particular, you need to be careful what packages you update. While '' | + | In particular, you need to be careful what packages you update. While '' |
| === Explanation 2 === | === Explanation 2 === | ||
| Line 134: | Line 141: | ||
| ===== Notes ===== | ===== Notes ===== | ||
| - | Example pictures: on formated | + | Example pictures: on formatted |
| * how data is stored and addressed by ext2: | * how data is stored and addressed by ext2: | ||
| * how data is stored and addressed by ext3: | * how data is stored and addressed by ext3: | ||
| Line 140: | Line 147: | ||
| * how data is stored and addressed by JFFS2: | * how data is stored and addressed by JFFS2: | ||
| - | ===== Archive ===== | ||
| - | |||
| - | * see [[doc: | ||