This is an old revision of the document!


OpenWrt File System Hierarchy / Memory Usage

<HTML> <table class=“inline”>

<tr class="row0">
	<th class="col0 centeralign" colspan="11"> OpenWrt File System Hierarchy </th>
</tr>
<tr class="row1">
	<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>
</tr>
<tr class="row2">
	<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>
</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>

  • / this is your entire root filesystem, it comprises /rom and /overlay. Please ignore /rom and /overlay and use exclusively / for your daily routines!
  • /rom contains all the basic files, like busybox, dropbear or iptables. It also includes default configuration files used when booting into 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.
  • /overlay 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 installation, e.g. changed configuration files, additional packages installed with 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.
    #!/bin/sh
    # shows all overlay-whiteout symlinks in the directory /overlay
     
    find /overlay -type l | while read FILE
      do
        [ -z "$FILE" ] && break
        if ls -la "$FILE" 2>&- | grep -q '(overlay-whiteout)'; then
        echo "$FILE"
        fi
      done
  • /tmp is a tmpfs-partition
    #!/bin/sh
    # shows current size of the tmpfs-partition mounted to /tmp
    calc_tmpfs_size() {pi_size=$(awk '/MemTotal:/ {l=10485760;mt=($2*1024);print((s=mt/2)<l)&&(mt>l)?mt-l:s}' /proc/meminfo)}}
    echo $pi_size
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2018/02/20 20:37
  • by