[OpenWrt Wiki] Filesystems (2024)

This article is about file systems used by OpenWrt for device built-in flash.

For installing additional file systems, including partitioning and mounting, see this page for general storage as well as this page to other common filesystems.

Please read about the flash.layout as well. Also, note that there are two types of flash memory: NOR flash and NAND flash. See also mtd.

Common File System

OverlayFS

Used to merge two filesystems, one read-only and the other writable. flash.layout explains how this is used in OpenWrt.

  • https://dev.openwrt.org/browser/trunk/target/linux/generic/patches-2.6.38/209-overlayfs.patch?rev=26213

  • Debating overlayfs on LWN.net

  • Was mainlined in Linux kernel 3.18

  • Overlayfs's support for inotify mechanisms is not complete yet. Events like IN_CLOSE_WRITE cannot be notified to listening process.

tmpfs

tmpfs is implemented on many Unix-like operating systems (including OpenWrt). It operates similar to a RAM-Disk, without writing files to disk. In OpenWrt, /tmp resides on a tmpfs-partition and /var is a symlink to it; /dev resides on a little tmpfs partition of its own.

  • (+) doesn't directly use space on non-volatile storage

  • (-) no wear leveling

  • (-) volatile (doesn't survive a reboot)

SquashFS

SquashFS is a read only compressed filesystem. While gzip is available, at OpenWrt it uses LZMA for the compression. Since SquashFS is a read only filesystem, it doesn't need to align the data, allowing it to pack the files tighter thus taking up significantly less space than JFFS2 (20-30% savings over a JFFS2 filesystem)!

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 squashfs and NAND flash). That's why raw SquashFS is a bad idea on NAND (it works if you use a FTL like UBIFS).

JFFS2

JFFS2 is a writable compressed filesystem with journaling and wear leveling using LZMA for the compression.

  • (+) is writable, has journaling and wear leveling

  • (+) is cool

  • (-) is compressed, so a program (opkg in particular) cannot know in advance how much space a package will occupy

  • (+) 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

ext2

  • Ext2/3/4 is used on x86, x86-64 and for some arch with SD-card rootfs

  • (+) a program (opkg in particularly) knows how much space is left!

  • (+) good ol' veteran FOSS file system

  • (-) no journaling (ext3, ext4 support journaling)

  • (-) no wear leveling

  • (-) no transparent compression

Other filesystems

OpenWrt does not use other filesystems as rootfs. It supports several filesystems attached to via various mechanisms like USB, SATA or network. For a list see storage.

mini_fo

Implementation in OpenWrt

The 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 LZMA and gzip, as documented in imagebuilder.

Boot process

System bootup is as follows: →process.boot

  1. kernel boots from a known raw partition (without a FS), scans mtd partition rootfs for a valid superblock and mounts the SquashFS partition (containing /etc) then runs /etc/preinit. (More info at technical.details)

  2. /etc/preinit runs /sbin/mount_root

  3. mount_root mounts the JFFS2 partition (/overlay) and combines it with the SquashFS partition (/rom) to create a new virtual root filesystem (/)

  4. bootup continues with /sbin/init

/overlay was previously named /jffs2

Explanations

[OpenWrt Wiki] Filesystems (2): Please feel free to merge Explanation 1 with Explanation 2

Explanations 1

Both SquashFS and JFFS2 are compressed filesystems using LZMA for the compression. SquashFS is a read only filesystem while JFFS2 is a writable filesystem with journaling and wear leveling.
Our job when writing the firmware is to put as much common functionality on SquashFS while not wasting space with unwanted features. Additional features can always be installed onto JFFS2 by the user. The use of mini_fo/overlayfs means that the filesystem is presented as one large writable filesystem to the user with no visible boundary between SquashFS and JFFS2 -- files are simply copied to JFFS2 when they're written.
It's not all without side effects however.
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, 0xdeadc0de; when this value appears in a JFFS2 partition, everything from that point to the end of the partition is wiped. So, hidden at the end of the firmware images, is the value 0xdeadcode, positioned such that it becomes the start of the JFFS2 partition.
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 opkg is more than happy to install an updated package on JFFS2, it's unable to remove the original package from SquashFS; the end result is that you slowly start using more and more space until the JFFS2 partition is filled. The opkg util really has no idea how much space is available on the JFFS2 partition since it's compressed, and so it will blindly keep going until the opkg system crashes -- at that point you have so little space you probably can't even use opkg to remove anything.

Explanation 2

On many embedded targets that use NOR flash for the root filesystem, OpenWrt implements a clever trick to get the most out of the limited flash memory capacity while retaining flexibility for the end-user:
Basically, during the image creation, all of the rootfs contents is packed up in a SquashFS filesystem -- a highly efficient filesystem with compression support. There's one important detail about it though: it is a read-only filesystem. To overcome this limitation OpenWrt uses the remaining portion of the NOR rootfs partition to store an additional read/write jffs2 filesystem which is “overlayed” on top of the rootfs (that is, allowing to read unchanged files from the SquashFS but storing all the modifications made to the jffs2 part).
This design has another important advantage for the end-user: even when the read/write partition is in total mess, he can always boot to the failsafe mode (which mounts only the squashfs part) and proceedfrom there.

Technical Details

The kernel boot process involves discovering of partitions within the NOR flash and it can be done by various target-dependent means:

  • some bootloaders store a partition table at a known location

  • some pass the partition layout via kernel command line

  • some targets require specifying the kernel command line at the compile time (thus overriding the one provided by the bootloader).

Either way, if there is a partition named rootfs and MTD_ROOTFS_ROOT_DEV kernel config option is set to yes, this partition is automatically used for the root filesystem.

After that, if MTD_ROOTFS_SPLIT is enabled, the kernel adjusts the rootfs partition size to the minimum required by the particular SquashFS image and automatically adds rootfs_data to the list of the available mtd partitions setting its beginning to the first appropriate address after the SquashFS end and size to the remainder of the original rootfs partition. The resulting list is stored in RAM only, so no partition table of any kind gets actually modified.

For more details please refer to the actual patch at:https://dev.openwrt.org/browser/trunk/target/linux/generic/patches-2.6.37/065-rootfs_split.patch

For overlaying a special mini_fo filesystem is used, the README is available from the sources athttps://dev.openwrt.org/browser/trunk/target/linux/generic/patches-2.6.37/209-mini_fo.patch

Can we switch the filesystem to be entirely JFFS2?

Note:: It is possible to contain the entire root filesystem on a JFFS2-Partition only, instead of a combination of both.The advantage is that changes to included files no longer leaves behind an old copy on the read only filesystem. So you could end up saving space.The disadvantage of this would be, that you have no failsafe any longer and also, JFFS2 takes significantly more space then SquashFS.

Yes, it's technically possible, but a bit of a mess to actually pull off. The firmware has to be loaded as a trx file, which means that you have to put the JFFS2 data inside of the trx. But, as I said above, the trx has a checksum, meaning that if you ever change that data, you invalidate the checksum. The solution is that you install with the JFFS2 data contained within the trx, and then change the trx-boundaries at runtime. The end result is a single JFFS2 partition for the root filesystem. Why someone would want to do it is beyond me; it takes more space, and while it would allow you to upgrade the contents of the filesystem you would still be unable to replace the kernel (outside of the filesystem), meaning that a seamless upgrade between releases is still not possible! Having SquashFS gives you a failsafe mechanism where you can always ignore the JFFS2 partition and boot directly off SquashFS, or restore files to their original SquashFS versions.

I used to have a trick where I could convert a SquashFS install to a JFFS2 install at runtime by copying all the data onto the SquashFS partition and changing the partition boundaries. I never really had much use for the util -- not to mention it required a rather large flash to store both SquashFS and JFFS2 copies of the root during transition -- so support for it was dropped.

Notes

Example pictures: on formatted partition / how data is stored (and addressed on ext3)

  • how data is stored and addressed by ext2:

  • how data is stored and addressed by ext3:

  • how data is stored and addressed by SquashFS:

  • how data is stored and addressed by JFFS2:

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

[OpenWrt Wiki] Filesystems (2024)

FAQs

What is the recommended memory for OpenWrt? ›

Please note that the OpenWrt project itself does not endorse any hardware or manufacturer unless there's a public statement, this is solely a list put together by the community. General recommendations are at least 16 Mbyte of flash and 128 Mbyte of RAM.

What filesystem does OpenWrt support? ›

OpenWrt/Linux filesystems

The two most common Linux filesystems are ext4 and f2fs, with btrfs growing in popularity: ext4 is well suited for HDDs and SSDs (using TRIM) and is the default filesystem of most desktop Linux distributions. f2fs is well suited for flash (SSDs or USB thumbdrives).

How do I access OpenWrt web interface? ›

Open a web browser, enter "https://192.168.1.1" in the Address bar, and hit [ENTER]. If you see a browser error like the one above, use these instructions to continue. 3. Enter "root" as the username and use the default password found at the bottom of the router, which is the same as the default SSID password.

What Linux is OpenWrt based on? ›

The experimental versions use a heavily customized build system based on buildroot2 from the uClibc project. OpenWrt uses official GNU/Linux kernel sources and only adds patches for the system on chip and drivers for the network interfaces.

Is OpenWRT faster than pfSense? ›

On APU routers pfSense and OPNsense achieve about 100Mbit/s throughput. OpenWRT achieves about 140Mbit/s. APU delivers more than 600Mbit/s with Wireguard VPN. If you have a choice between OpenVPN and Wigeguard, choose the latter.

Is OpenWRT faster than stock? ›

Others may be able to answer more specifially about this AP, but many APs have good wifi performance on OpenWrt -- generally equivalent to (and sometimes better than) the stock firmware. However, certain chipsets are not as well supported and may have worse performance.

What is the most compatible filesystem? ›

If you have a smaller flash drive or removable storage, FAT32 can likely get the job done. However, for larger storage devices that have higher file capacity, exFAT may be best. Both formats offer cross-platform compatibility for an external drive you plan to use on multiple machines.

Can I run OpenWrt in a VM? ›

OpenWrt can run in normal PC, VM, or server hardware, and take advantage of the much more powerful hardware the x86 (Intel/AMD) architecture can offer.

What is the device limit for OpenWrt? ›

Default builds of OpenWrt 21.02 can only run on 8/64 devices. Every operating system requires: Sufficient RAM for stable operation.

What is the root password for OpenWrt? ›

root is the username of the main administrative user on OpenWrt. We'll need to set that after we login. Log in with the username of root and leave the password field empty. Note: If you cannot log in when the “No password set!” message is on-screen, even when the password field is blank, it could be a cookie problem.

What is LuCI in OpenWrt? ›

LuCI is the main web administration utility for OpenWrt. By default LuCI uses uHTTPd. You can use other web servers for LuCI. There are a couple available in the OpenWrt archives: webserver This article explains how to run the LuCI web interface on the lighttpd web server.

What is the default web password for OpenWrt? ›

Host name: OpenWrt device IP address (default is 192.168. 1.1 ) User Name: root (this is the “administrator” and only user in default OpenWrt) Password: leave this blank for your first connection, then write the password you set up (either in Luci GUI or after your first SSH access)

What is the most stable version of OpenWrt? ›

The current stable version series of OpenWrt is 23.05, with v23. 05.4 being the latest release of the series. It was released on 20. July 2024.

How much RAM does OpenWrt use? ›

16MB Flash will provide for bare minimum installed packages. Devices with more storage is recommended. 128MB RAM will provide for minimal functionality.

What firewall does OpenWrt use? ›

OpenWrt uses the firewall4 ( fw4 ) netfilter/nftables rule builder application. It runs in user-space to parse a configuration file into a set of nftables rules, sending each to the kernel netfilter modules.

How much space does OpenWRT need? ›

How much disk space is needed for compiling?
BranchMin.Max.
typical, Stable10 GB20 GB
Development?15 GB
Development+feeds?15 GB
all feeds/pkgsx
1 more row
Sep 11, 2019

Does OpenWRT run in RAM? ›

Yes you can use an "initrd" image which includes the root filesystem as a RAM drive. You need a way to load it into RAM though. mk24 wrote: Yes you can use an "initrd" image which includes the root filesystem as a RAM drive.

What size memory do I need? ›

For basic everyday use such as web browsing and document creation, 4GB or 8GB is usually sufficient. For more intensive tasks such as gaming or video editing 16GB or even 32GB of RAM is better.

How much installed memory do I need? ›

Generally, we recommend 8GB of RAM for casual computer usage and internet browsing, 16GB for spreadsheets and other office programs, and at least 32GB for gamers and multimedia creators. How you use your computer influences how much RAM you need, so use this as a guideline.

Top Articles
Our Pick Of The Best Compound Interest Investments
Tax Issues Facing Federal Employees Who Divorce — Part 2: Alimony, Child Support and Tax Carryforwards
Walgreens Harry Edgemoor
Nybe Business Id
Metra Union Pacific West Schedule
Danielle Moodie-Mills Net Worth
Loves Employee Pay Stub
Manhattan Prep Lsat Forum
Craigslist Mpls Mn Apartments
Lexington Herald-Leader from Lexington, Kentucky
Nwi Police Blotter
Ou Class Nav
Blue Beetle Showtimes Near Regal Swamp Fox
2024 Non-Homestead Millage - Clarkston Community Schools
Learn2Serve Tabc Answers
Spergo Net Worth 2022
Velocity. The Revolutionary Way to Measure in Scrum
라이키 유출
How Much Is Tay Ks Bail
How pharmacies can help
Aaa Saugus Ma Appointment
Highmark Wholecare Otc Store
2487872771
Marilyn Seipt Obituary
Cowboy Pozisyon
Ultra Ball Pixelmon
Tomb Of The Mask Unblocked Games World
Craftsman Yt3000 Oil Capacity
Bj's Tires Near Me
Courtney Roberson Rob Dyrdek
Robert A McDougal: XPP Tutorial
What does wym mean?
Nacho Libre Baptized Gif
4083519708
Asian Grocery Williamsburg Va
Imperialism Flocabulary Quiz Answers
Infinite Campus Parent Portal Hall County
Yogu Cheshire
M Life Insider
Ukraine-Krieg - Militärexperte: "Momentum bei den Russen"
Charli D'amelio Bj
Child care centers take steps to avoid COVID-19 shutdowns; some require masks for kids
Alba Baptista Bikini, Ethnicity, Marriage, Wedding, Father, Shower, Nazi
DL381 Delta Air Lines Estado de vuelo Hoy y Historial 2024 | Trip.com
Walmart Front Door Wreaths
Argus Leader Obits Today
Ciara Rose Scalia-Hirschman
Is Chanel West Coast Pregnant Due Date
Maurices Thanks Crossword Clue
Ics 400 Test Answers 2022
Philasd Zimbra
Cataz.net Android Movies Apk
Latest Posts
Article information

Author: Domingo Moore

Last Updated:

Views: 5973

Rating: 4.2 / 5 (53 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Domingo Moore

Birthday: 1997-05-20

Address: 6485 Kohler Route, Antonioton, VT 77375-0299

Phone: +3213869077934

Job: Sales Analyst

Hobby: Kayaking, Roller skating, Cabaret, Rugby, Homebrewing, Creative writing, amateur radio

Introduction: My name is Domingo Moore, I am a attractive, gorgeous, funny, jolly, spotless, nice, fantastic person who loves writing and wants to share my knowledge and understanding with you.