tags: - openwrt - overlay categories: - informational comments: true
Setup an overlay/extroot partition using a USB external drive on openwrt router
reboot
df -h
opkg update && opkg install block-mount kmod-fs-ext4 kmod-usb-storage kmod-usb-ohci kmod-usb-uhci e2fsprogs fdisk
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
grep -e rootfs_data /proc/mtd
mkfs.ext4 /dev/sda1
DEVICE="/dev/sda1"
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
mount /dev/sda1 /mnt
cp -f -a /overlay/. /mnt
umount /mnt
reboot
https://openwrt.org/docs/guide-user/additional-software/extroot_configuration