Copy everything from flash chip to USB - extroot

I built my own opewrt image with a preconfigured /etc/config/fstab so it uses extroot asap on the first boot. I notice a small performance improvement, and I hope is not simply a placebo effect, by loading data from USB instead of spi flash chip. My idea will be to copy every real file from lower overlay layer (spi flash chip) to upper layer (usb drive) so everything is handled by the USB drive.

Does this makes sense? Also how can I reliably copy all files (and directory structure, permissions, etc...) from lower layer to upper layer without getting everything messed up by handling wrongly simlinks, not-real files (es: /dev/sda), etc .... etc... ?

is it extroot-/overlay or extroot-/?

for the latter, if you've embedded /etc/config/fstab at first boot, then you have to populate your usb on a pc using a rootfs.tar.gz or extracting files from the squash.fs / rom

for the former, you could do a similar thing, or choose to leave it less populated as only new files are technically needed there.

how to copy? heaps of guides and commands on the wiki. if your doing it on a pc you'll have to be more specific about the device, img your using, buildroot/download/imagebuilder?

extroot-/overlay (whats the difference with / ?)

And I have a TD-W9980 (it's a TD-W8980 with a different plastic case) and built my image from source (git clone, make menuconfig, etc.... etc... ).

Is this safe? file permissions wise

  • for your use case, extroot-/ is more appropriate.
  • enable rootfs.tar.gz in your buildroot. then extract to usb.