I found the Extroot Configuration page to be confusing and jargon-laden. I took a stab at rewriting it, but have no idea if it's correct. So I appeal to the wisdom of our readers for guidance...
Here's the first part of the description. Is it correct as far as it goes? Thanks.
5Feb2019 based on first set of comments. This is great! Please keep adding comments!
The procedure below describes how to use a storage device (USB stick, SATA drive, SD card, or other) to expand the root filesystem of your OpenWrt device. This external-memory root filesystem ("extroot") can be as large as the storage device you add. This allows you to install more packages than would otherwise be possible.
You will need to connect an external storage device to your router. The easiest way to do this is to connect a USB stick with at least
Note: This procedure is designed to work with OpenWrt 17.01.5 or newer.
Note: Although many devices with 4MBytes of Flash can usually be expanded using this extroot procedure, the memory requirements for the base OpenWrt plus the additional packages required may exceed the 4Mbytes.
Note: Devices with 4MBytes of Flash frequently have only 32MBytes of RAM, which may still be too little for a useful, functional router. You will have to determine if this procedure will benefit you, or whether a router with > 4MBytes Flash/32 MBytes RAM would serve you better.
In OpenWrt devices, the firmware supports two partitions of internal storage.
- OpenWrt's "root" partition is a highly-compressed read-only partition, stored in the Flash memory from the original manufacturer. Since it's the root of the filesystem, it's stored at
- OpenWrt supports a second (usually removable) "overlay" partition that is writable. It is at
/overlayin the filesystem.
The overlay partition contains a full copy of the root filesystem. Because the overlay partition's device is larger than the original Flash memory, it also has space available for more packages.
When the router boots and detects an overlay partition, it mounts that overlay partition in place of the (former) root partition. Since it contains a copy of the original root partition, the router operates exactly as before, with the addition of any other packages that are present in the overlay partition.
This approach also allows easy fallback in case the external storage device is removed. The OpenWrt device still has its original root partition and will load its firmware and configuration from there.
You need to install several packages to create an ext4 filesystem on the (new) overlay partition.
Connect the USB stick/device to the router.
SSH into the router and enter the following commands into the SSH window.
opkg update && opkg install block-mount e2fsprogs kmod-fs-ext4 kmod-usb-storage kmod-usb2
If you see any error messages, you may not have sufficient internal memory to support an extroot (true?) See ??? for more information on troubleshooting this.
Discover the current set of devices on the router. Enter
block info and you will see something like this:
root@OpenWrt:~# block info /dev/mtdblock2: UUID="1748d829-b790e1c0-4aac514d-aa6fd187" VERSION="4.0" MOUNT="/rom" TYPE="squashfs" /dev/mtdblock3: MOUNT="/overlay" TYPE="jffs2" /dev/sda: UUID="b44cad51-40cd-4f96-b79e-2cdfbaf88d90" VERSION="1.0" MOUNT="/opt" TYPE="ext4" /dev/sdb: UUID="2015-11-03-03-23-01-00" LABEL="TEST - 20151103" TYPE="iso9660" /dev/sdb1: UUID="2015-11-03-03-23-01-00" LABEL="TEST - 20151103" TYPE="iso9660"
- /dev/mtdblock devices are the internal partitions of the internal Flash memory
- /dev/sdX devices are external USB devices. /dev/sda is the first USB device; /dev/sdb is a second device.
- /dev/sda1 is the first partition on the /dev/sda device; /dev/sda2 is the second partition, etc.
That's as far as I got - correct so far? Thanks.