Installing and updating OpenWRT on USB Stick

Hello,

I need more space on my Linksys WRT1900ACSv2 to install some packages and now I am wondering how to install and boot from USB. This is the way I have done it in the past to install Samba:

# 1. Preparation
opkg update && opkg install block-mount kmod-fs-ext4 e2fsprogs fdisk
reboot

# 2. Configuring rootfs_data
DEVICE="$(sed -n -e "/\s\/overlay\s.*$/s///p" /etc/mtab)"
uci -q delete fstab.rwm
uci set fstab.rwm="mount"
uci set fstab.rwm.device="${DEVICE}"
uci set fstab.rwm.target="/rwm"
uci commit fstab

# 3. Configuring extroot
DEVICE="/dev/sda1"
mkfs.ext4 ${DEVICE}
eval $(block info ${DEVICE} | grep -o -e "UUID=\S*")
uci -q delete fstab.overlay
uci set fstab.overlay="mount"
uci set fstab.overlay.uuid="${UUID}"
uci set fstab.overlay.target="/overlay"
uci commit fstab

# 4. Transferring data
mkdir -p /tmp/cproot
mount --bind /overlay /tmp/cproot
mount ${DEVICE} /mnt
tar -C /tmp/cproot -cvf - . | tar -C /mnt -xf -	
umount /tmp/cproot /mnt
reboot

I switched to ksmbd and don't needed the additional space for the last year, but now I want to try to run docker on my router to run home-assistant without any additional hardware.

Everytime I want to update my router I deleted the USB stick and started from scratch.

So I have two questions.

  1. Is there a better or easier way to install OpenWRT to a stick and boot from it.
  2. Can I Update OpenWRT on my stick instead of wiping it and do all the steps again?

If there is a solution for updating the installation on the stick this would be really helpful.

That is not possible. Most all-in-one routers must boot from their internal flash meomry.

However, you can do extroot as you seem to be showing.

There's not enough RAM, even if you could fit everything in flash. Home Assistant's website says Pi3 or newer as a minimum.. the Pi3B has 1GB RAM. The total for your WRT1900ACSv2 is 512MB, and in that footprint, you'd also need to run OpenWrt (of course -- figure that will need 64MB minimum) + Docker (which I think won't work either) + HA.

On your existing device, no booting, but you can use extroot. Or, if you want to boot from USB, look into devices that aren't 'consumer routers' -- things like single-board computers or x86 devices often have this capability, but the vast majority of consumer wifi routers cannot boot from USB.

No. A similar recent discussion may be of interest here:

2 Likes