tags: - openwrt - overlay categories: - informational comments: true

date: 2022-08-20 00:00:00

DESCRIPTION

Setup an overlay/extroot partition using a USB external drive on openwrt router

ERRORS

VERIFICATION

reboot
df -h

COMMANDS

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

REFERENCES

https://openwrt.org/docs/guide-user/additional-software/extroot_configuration