| Both sides previous revision Previous revision Next revision | Previous revision |
| docs:techref:file_system [2018/02/20 19:59] – ↷ Links adapted because of a move operation | docs:techref:file_system [2018/04/13 05:59] (current) – link updated tmomas |
|---|
| ====== OpenWrt File System Hierarchy / Memory Usage ====== | ====== OpenWrt File System Hierarchy / Memory Usage ====== |
| |
| <HTML> | ^ OpenWrt File System Hierarchy |||||||||| |
| <table class="inline"> | ^ ^ Flash Storage Partitioning (TP-Link WR1043ND) ||||^ Main Memory Usage |||| |
| <tr class="row0"> | ^ Hardware | m25p80 [[wp>spi]]0.0: m25p64 8192 KiB ||||| main memory 32 768 KiB |||| |
| <th class="col0 centeralign" colspan="11"> OpenWrt File System Hierarchy </th> | ^ Layer1 | @#de401d:mtd0 **//u-boot//** 128 KiB | @#25540b:mtd5 **//firmware//** 8000 KiB ||| @#1dbade:mtd4 **//art//** 64 KiB | @#ff00ff:Kernel space 3828 KiB | @#00ffff:User space 28 940 KiB ||| |
| </tr> | ^ Layer2 | @#de401d: | @#a11dde:mtd1 **//kernel//** 1280 KiB | @#378712:mtd2 **//rootfs//** 6720 KiB || @#1dbade: | @#ff00ff: | @#00ffff:up to 50% | @#00ffff:512 KiB | @#00ffff:remaining | |
| <tr class="row1"> | ^ mountpoint | @#de401d: | @#a11dde: | @#378712:/ || @#1dbade: | @#ff00ff: | @#00ffff: | @#00ffff: | @#00ffff: | |
| <th class="col0 leftalign"> </th> <th class="col1 centeralign" colspan="5"> Flash Storage Partitioning (TP-Link WR1043ND) </th><th class="col7 centeralign" colspan="4"> Main Memory Usage </th> | ^ filesystem | @#de401d: | @#a11dde: | @#378712:[[docs:techref:filesystems#overlayfs]] || @#1dbade: | @#ff00ff: | @#00ffff: | @#00ffff: | @#00ffff: | |
| </tr> | ^ Layer3 | @#de401d: | @#a11dde: | @#dea11d:1536 KiB | @#5ade1d:mtd3 **//rootfs_data//** 5184 KiB | @#1dbade: | @#ff00ff: | @#00ffff: | @#00ffff: | @#00ffff: | |
| <tr class="row2"> | ^ mountpoint | @#de401d:none | @#a11dde:none | @#dea11d:/rom | @#5ade1d:/overlay | @#1dbade:none | @#ff00ff: | @#00ffff:/tmp | @#00ffff:/dev | @#00ffff: | |
| <th class="col0 leftalign"> Hardware </th><td class="col1 centeralign" colspan="5"> m25p80 <a href="http://en.wikipedia.org/wiki/Serial Peripheral Interface Bus" class="interwiki iw_wp" title="http://en.wikipedia.org/wiki/Serial Peripheral Interface Bus">spi</a>0.0: m25p64 8192 KiB </td><td class="col7 centeralign" colspan="4"> main memory 32 768 KiB </td> | ^ filesystem | @#de401d:none | @#a11dde:none | @#dea11d:[[docs:techref:filesystems#squashfs|SquashFS]] | @#5ade1d:[[docs:techref:filesystems#JFFS2|JFFS2]] | @#1dbade:none | @#ff00ff: | @#00ffff:[[docs:techref:filesystems#tmpfs|tmpfs]] | @#00ffff:[[docs:techref:filesystems#tmpfs|tmpfs]] | @#00ffff: | |
| </tr> | |
| <tr class="row3"> | |
| <th class="col0 leftalign"> Layer1 </th><td class="col1 centeralign" style="background:#de401d;"> mtd0 <strong><em>u-boot</em></strong> 128 KiB </td><td class="col2 centeralign" style="background:#25540b;" colspan="3"> mtd5 <strong><em>firmware</em></strong> 8000 KiB </td><td class="col5 centeralign" style="background:#1dbade;"> mtd4 <strong><em>art</em></strong> 64 KiB </td><td class="col6 centeralign" style="background:#ff00ff;">Kernel space 3828 KiB<td class="col7 centeralign" style="background:#00ffff;" colspan="3">User space 28 940 KiB</td> | |
| </tr> | |
| <tr class="row4"> | |
| <th class="col0 leftalign"> Layer2 </th><td class="col1 centeralign" style="background:#de401d;"> </td><td class="col2 centeralign" style="background:#a11dde;"> mtd1 <strong><em>kernel</em></strong> 1280 KiB </td><td class="col3 centeralign" style="background:#378712;" colspan="2"> mtd2 <strong><em>rootfs</em></strong> 6720 KiB </td><td class="col5 centeralign" style="background:#1dbade;"> </td><td class="col6 centeralign" style="background:#ff00ff;"><td class="col7 centeralign" style="background:#00ffff;">up to 50%</td><td class="col8 centeralign" style="background:#00ffff;">512 KiB</td><td class="col9 centeralign" style="background:#00ffff;">remaining</td> | |
| </tr> | |
| <tr class="row5"> | |
| <th class="col0 leftalign"> <span style='color:magenta;'><code>mountpoint</code></span> </th><td class="col1 centeralign" style="background:#de401d;"> </td><td class="col2 centeralign" style="background:#a11dde;"> </td><td class="col3 centeralign" colspan="2" style="background:#378712;"> <span style='color:magenta; '><code>/</code></span> </td><td class="col5 centeralign" style="background:#1dbade;"> </td><td class="col6 centeralign" style="background:#ff00ff;"><td class="col7 centeralign" style="background:#00ffff;"></td><td class="col8 centeralign" style="background:#00ffff;"></td><td class="col9 centeralign" style="background:#00ffff;"></td> | |
| </tr> | |
| <tr class="row6"> | |
| <th class="col0 leftalign"> filesystem </th><td class="col1 centeralign" style="background:#de401d;"> </td><td class="col2 centeralign" style="background:#a11dde;"> </td><td class="col3 centeralign" style="background:#378712;" colspan="2"> <a href="http://wiki.openwrt.org/doc/techref/filesystems#overlayfs" class="wikilink2" title="doc:techref:filesystems" rel="nofollow">overlayfs</a> </td><td class="col5 centeralign" style="background:#1dbade;"> </td><td class="col6 centeralign" style="background:#ff00ff;"><td class="col7 centeralign" style="background:#00ffff;"></td><td class="col8 centeralign" style="background:#00ffff;"></td><td class="col9 centeralign" style="background:#00ffff;"></td> | |
| </tr> | |
| <tr class="row7"> | |
| <th class="col0 leftalign"> Layer3 </th><td class="col1 centeralign" style="background:#de401d;"> </td><td class="col2 centeralign" style="background:#a11dde;"> </td><td class="col3 centeralign" style="background:#dea11d;"> 1536 KiB </td><td class="col4 centeralign" style="background:#5ade1d;"> mtd3 <strong><em>rootfs_data</em></strong> 5184 KiB </td><td class="col5 centeralign" style="background:#1dbade;"> </td><td class="col6 centeralign" style="background:#ff00ff;"><td class="col7 centeralign" style="background:#00ffff;"></td><td class="col8 centeralign" style="background:#00ffff;"></td><td class="col9 centeralign" style="background:#00ffff;"></td> | |
| </tr> | |
| <tr class="row8"> | |
| <th class="col0 leftalign"> <span style='color:magenta;'><code>mountpoint</code></span> </th><td class="col1 centeralign" style="background:#de401d;"> <code>none</code> </td><td class="col2 centeralign" style="background:#a11dde;"> <code>none</code> </td><td class="col3 centeralign" style="background:#dea11d;"> <span style='color:magenta; '><code>/rom</code></span> </td><td class="col4 centeralign" style="background:#5ade1d;"> <span style='color:magenta; '><code>/overlay</code></span> </td><td class="col5 centeralign" style="background:#1dbade;"> <code>none</code> </td><td class="col6 centeralign" style="background:#ff00ff;"><td class="col7 centeralign" style="background:#00ffff;"><span style='color:magenta; '><code>/tmp</code></span></td><td class="col8 centeralign" style="background:#00ffff;"><span style='color:magenta; '><code>/dev</code></span></td><td class="col9 centeralign" style="background:#00ffff;"></td> | |
| </tr> | |
| <tr class="row9"> | |
| <th class="col0 leftalign"> filesystem </th><td class="col1 centeralign" style="background:#de401d;"> <em>none</em> </td><td class="col2 centeralign" style="background:#a11dde;"> <em>none</em> </td><td class="col3 centeralign" style="background:#dea11d;"> <a href="http://wiki.openwrt.org/doc/techref/filesystems#squashfs" class="wikilink2" title="doc:techref:filesystems" rel="nofollow">SquashFS</a> </td><td class="col4 centeralign" style="background:#5ade1d;"> <a href="http://wiki.openwrt.org/doc/techref/filesystems#jffs2" class="wikilink2" title="doc:techref:filesystems" rel="nofollow">JFFS2</a> </td><td class="col5 centeralign" style="background:#1dbade;"> <em>none</em> </td><td class="col6 centeralign" style="background:#ff00ff;"><td class="col7 centeralign" style="background:#00ffff;"><a href="http://wiki.openwrt.org/doc/techref/filesystems#tmpfs" class="wikilink2" title="doc:techref:filesystems" rel="nofollow">tmpfs</a></td><td class="col8 centeralign" style="background:#00ffff;"><a href="http://wiki.openwrt.org/doc/techref/filesystems#tmpfs" class="wikilink2" title="doc:techref:filesystems" rel="nofollow">tmpfs</a></td><td class="col9 centeralign" style="background:#00ffff;"></td> | |
| </tr> | |
| </table> | |
| </HTML> | |
| ==== Mount Points ==== | ==== Mount Points ==== |
| * <color magenta>''/''</color> this is your entire root filesystem, it comprises ''/rom'' and ''/overlay''. Please ignore ''/rom'' and ''/overlay'' and use exclusively ''/'' for your daily routines! | * <color magenta>''/''</color> this is your entire root filesystem, it comprises ''/rom'' and ''/overlay''. Please ignore ''/rom'' and ''/overlay'' and use exclusively ''/'' for your daily routines! |
| * <color magenta>''/rom''</color> contains all the basic files, like ''busybox'', ''dropbear'' or ''iptables''. It also includes default configuration files used when booting into [[docs:user-guide:failsafe_and_factory_reset|OpenWrt Failsafe mode]]. It does not contain the Linux kernel. All files in this directory are located on the SqashFS partition, and thus cannot be altered or deleted. But, because we use overlay_fs filesystem, so called //overlay-whiteout//-symlinks can be created on the JFFS2 partition. | * <color magenta>''/rom''</color> contains all the basic files, like ''busybox'', ''dropbear'' or ''iptables''. It also includes default configuration files used when booting into [[docs:guide-user:troubleshooting:failsafe_and_factory_reset|OpenWrt Failsafe mode]]. It does not contain the Linux kernel. All files in this directory are located on the SqashFS partition, and thus cannot be altered or deleted. But, because we use overlay_fs filesystem, so called //overlay-whiteout//-symlinks can be created on the JFFS2 partition. |
| * <color magenta>''/overlay''</color> is the writable part of the file system that gets merged with ''/rom'' to create a uniform ''/''-tree. It contains anything that was written to the router after [[docs:user-guide:installation:generic.flashing|installation]], e.g. changed configuration files, additional packages installed with ''[[docs:user-guide:additional-software:opkg]]'', etc. It is formated with JFFS2.\\ Rather than deleting the files, insert a whiteout, a special high-priority entry that marks the file as deleted. File system code that sees a whiteout entry for file F behaves as if F does not exist.\\ <code bash> | * <color magenta>''/overlay''</color> is the writable part of the file system that gets merged with ''/rom'' to create a uniform ''/''-tree. It contains anything that was written to the router after [[docs:guide-user:installation:generic.flashing|installation]], e.g. changed configuration files, additional packages installed with ''[[docs:guide-user:additional-software:opkg]]'', etc. It is formated with JFFS2.\\ Rather than deleting the files, insert a whiteout, a special high-priority entry that marks the file as deleted. File system code that sees a whiteout entry for file F behaves as if F does not exist.\\ <code bash> |
| #!/bin/sh | #!/bin/sh |
| # shows all overlay-whiteout symlinks in the directory /overlay | # shows all overlay-whiteout symlinks in the directory /overlay |