Published: Tue, Jul 08, 25

OpenWrt’s root filesystem onto a USB stick using Extroot


🛠️ Steps to Configure USB Extroot

1. Install Required Packages

First, ensure your OpenWrt system has the required packages:

opkg update
opkg install block-mount kmod-usb-storage kmod-fs-ext4 e2fsprogs kmod-scsi-core mount-utils

Note: If you plan to use FAT or NTFS instead of ext4, install:

opkg install kmod-fs-vfat kmod-fs-ntfs

However, ext4 is strongly recommended for Linux-based systems like OpenWrt.


2. Prepare Your USB Drive

Format your USB stick as ext4:

Replace /dev/sda with your actual device

mkfs.ext4 /dev/sda

Label it (optional but helpful):

e2label /dev/sda extroot

Mount it to verify:

mkdir -p /mnt/usb
mount /dev/sda /mnt/usb

Check contents:

ls /mnt/usb

If all looks good, unmount it:

umount /mnt/usb

3. Copy the Root Filesystem

Detect your block devices and update fstab:

block detect > /etc/config/fstab

Mount your USB stick temporarily:

mkdir -p /mnt/extroot
mount /dev/sda /mnt/extroot

Copy your overlay filesystem to the USB stick:

tar -C /overlay -cvf - . | tar -C /mnt/extroot -xvf -

Unmount it:

umount /mnt/extroot

4. Configure /etc/config/fstab

Edit the fstab file:

vi /etc/config/fstab

Locate the section corresponding to your USB device. Update it so it looks similar to this:

config mount
    option target '/overlay'
    option uuid '6a8bf7ef-a69f-4c35-a27d-18aa17f30381'
    option fstype 'ext4'
    option enabled '1'
    option enabled_fsck '1'
âś… How to find your UUID:

block info

Look for a line like:

/dev/sda1: UUID="6a8bf7ef-a69f-4c35-a27d-18aa17f30381" ...

Replace the UUID in your fstab config with your actual UUID.


5. Enable Extroot Support

Run the following commands to enable and start the mount services:

block detect > /etc/config/fstab
/etc/init.d/fstab enable
/etc/init.d/fstab start

6. Reboot and Verify

Reboot your router:

reboot

After reboot, check that your USB stick is mounted as the new root filesystem:

df -h

  • Look for /overlay showing the size of your USB stick rather than the small internal flash. Optional: LuCI Web Interface

Go to System → Mount Points in LuCI.

Find your extroot mount.

Check Enable and Save & Apply.

Reboot again.

  • Verify using LuCI → Status → Overview or df -h to confirm the overlay is mounted from USB.

âś… Why Extroot?

Avoid running out of space on small routers.

Store large logs or data without risk of filling flash.

Install bigger packages (e.g. VPNs, network tools).

This makes your OpenWrt install far more powerful!