OpenWrt File System Hierarchy / Memory Usage

OpenWrt File System Hierarchy
Flash Storage Partitioning (TP-Link WR1043ND) Main Memory Usage
Hardware m25p80 spi0.0: m25p64 8192 KiB main memory 32 768 KiB
Layer1 mtd0 u-boot 128 KiB mtd5 firmware 8000 KiB mtd4 art 64 KiB Kernel space 3828 KiB User space 28 940 KiB
Layer2 mtd1 kernel 1280 KiB mtd2 rootfs 6720 KiB up to 50% 512 KiB remaining
mountpoint /
filesystem overlayfs
Layer3 1536 KiB mtd3 rootfs_data 5184 KiB
mountpoint none none /rom /overlay none /tmp /dev
filesystem none none SquashFS JFFS2 none tmpfs tmpfs
  • / 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.
    # shows all overlay-whiteout symlinks in the directory /overlay
    find /overlay -type l | while read FILE
        [ -z "$FILE" ] && break
        if ls -la "$FILE" 2>&- | grep -q '(overlay-whiteout)'; then
        echo "$FILE"
  • /tmp is a tmpfs-partition
    # 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/04/13 05:59
  • by tmomas