Extroot Not Mounting on OpenWRT

Hello everyone,

I’m experiencing an issue setting up extroot on my ZyXEL NBG6817 router running OpenWRT 23.05.3. Despite following the standard extroot configuration steps, the system fails to mount /overlay on my USB flash drive (/dev/sda1) after a reboot. Instead, it continues to use the internal memory (/dev/loop0), leaving me with limited space for additional software and configurations.

What I’ve Done So Far

  1. Formatted the USB Drive:

    • The USB flash drive (32GB) was formatted to ext4 using mkfs.ext4.
    • Verified the UUID using block info.
  2. Updated /etc/config/fstab:
    I configured the /etc/config/fstab file as follows:

    config 'global'
        option anon_swap       '0'
        option anon_mount      '0'
        option auto_swap       '1'
        option auto_mount      '1'
        option delay_root      '30'
        option check_fs        '1'
    
    config 'mount'
        option target  '/overlay'
        option uuid    '<UUID-of-my-USB-drive>'
        option fstype  'ext4'
        option enabled '1'
    
  3. Copied Files to the USB Drive:
    Used the following commands to copy /overlay to the USB drive:

    mount /dev/sda1 /mnt
    tar -C /overlay -cvf - . | tar -C /mnt -xvf -
    umount /mnt
    
  4. Ensured Kernel Modules Are Loaded at Boot:

    • Verified that usb-storage, usb-storage-extras, and ext4 modules are installed.

    • Created symbolic links in /etc/modules-boot.d/ to ensure they load during boot:

      ln -s /etc/modules.d/usb-storage /etc/modules-boot.d/usb-storage
      ln -s /etc/modules.d/usb-storage-extras /etc/modules-boot.d/usb-storage-extras
      ln -s /etc/modules.d/30-fs-ext4 /etc/modules-boot.d/30-fs-ext4
      
  5. Checked for Errors:

    • Logs from logread and dmesg indicate that the USB drive is detected after the system attempts to mount /overlay.

    • Example:

      [7.370701] EXT4-fs (loop0): mounted filesystem with ordered data mode.
      [8.493107] scsi 0:0:0:0: Direct-Access USB DISK 2.0
      [8.497058] sd 0:0:0:0: [sda] Attached SCSI removable disk
      [8.868114] mount_root: switching to ext4 overlay
      

The Problem

Despite following the steps, /overlay continues to mount on the internal memory (/dev/loop0) instead of the USB drive (/dev/sda1) after a reboot.

I suspect the issue might be:

  • USB initialization delay: The USB drive is detected too late during the boot process.
  • Missing initramfs support: Modules for usb-storage or ext4 might not be loading early enough.

System Details

  • Router Model: ZyXEL NBG6817 (Link to OpenWRT page)
  • Firmware Version: OpenWRT 23.05.3
  • USB Drive: 32GB, formatted to ext4.

What I Need Help With

  • Ensuring /overlay mounts on /dev/sda1 at boot.

If anyone has experience with extroot on this router model or similar setups, I’d greatly appreciate your insights or suggestions.

Thank you in advance!

How fid you fill 4GB builtin flash?

What is initramfs? What is it supposed to do?