Examples
This commit is contained in:
70
extroot.txt
70
extroot.txt
@@ -5,35 +5,18 @@ single ext4 partition, no data copied from internal flash.
|
|||||||
|
|
||||||
Assumptions (based on your box):
|
Assumptions (based on your box):
|
||||||
|
|
||||||
Device: GL-iNet XE300
|
Device: GL-iNet XE300, OpenWRT 24.10.4
|
||||||
|
|
||||||
OpenWrt: 24.x, fresh flash
|
|
||||||
|
|
||||||
SD card location: built-in slot
|
|
||||||
|
|
||||||
Detected as: /dev/sda with one partition /dev/sda1
|
Detected as: /dev/sda with one partition /dev/sda1
|
||||||
|
|
||||||
Overlay: You don't care about existing data on the card or in the old overlay
|
|
||||||
|
|
||||||
1. Insert card & install required packages
|
1. Insert card & install required packages
|
||||||
|
|
||||||
Insert the microSD card.
|
|
||||||
SSH into the router (root@192.168.x.x, etc).
|
|
||||||
|
|
||||||
Install the extroot-related packages:
|
|
||||||
|
|
||||||
opkg update
|
opkg update
|
||||||
opkg install block-mount kmod-fs-ext4 kmod-usb-storage e2fsprogs
|
opkg install block-mount kmod-fs-ext4 kmod-usb-storage e2fsprogs
|
||||||
|
|
||||||
|
|
||||||
What they do:
|
|
||||||
|
|
||||||
block-mount - block info, fstab handling, extroot logic
|
block-mount - block info, fstab handling, extroot logic
|
||||||
|
|
||||||
kmod-fs-ext4 - kernel driver for ext4 filesystem
|
kmod-fs-ext4 - kernel driver for ext4 filesystem
|
||||||
|
|
||||||
kmod-usb-storage - makes the SD slot show up as /dev/sda
|
kmod-usb-storage - makes the SD slot show up as /dev/sda
|
||||||
|
|
||||||
e2fsprogs - provides mkfs.ext4
|
e2fsprogs - provides mkfs.ext4
|
||||||
|
|
||||||
2. Confirm the SD card is /dev/sda and /dev/sda1
|
2. Confirm the SD card is /dev/sda and /dev/sda1
|
||||||
@@ -43,42 +26,25 @@ Check dmesg:
|
|||||||
dmesg | grep -i sd
|
dmesg | grep -i sd
|
||||||
|
|
||||||
|
|
||||||
On the XE300 you should see:
|
Sample Output:
|
||||||
|
|
||||||
sd 0:0:0:0: [sda] 1000005632 512-byte logical blocks: (512 GB/477 GiB)
|
sd 0:0:0:0: [sda] 1000005632 512-byte logical blocks: (512 GB/477 GiB)
|
||||||
sda: sda1
|
sda: sda1
|
||||||
sd 0:0:0:0: [sda] Attached SCSI removable disk
|
sd 0:0:0:0: [sda] Attached SCSI removable disk
|
||||||
|
|
||||||
|
|
||||||
This tells you:
|
|
||||||
|
|
||||||
Disk: /dev/sda
|
|
||||||
|
|
||||||
Partition already present: /dev/sda1
|
|
||||||
|
|
||||||
If /dev/sda1 is missing, you'd need to partition manually. In your case, it exists already.
|
|
||||||
|
|
||||||
3. Format /dev/sda1 as ext4 for extroot
|
3. Format /dev/sda1 as ext4 for extroot
|
||||||
mkfs.ext4 -L extroot /dev/sda1
|
mkfs.ext4 -L extroot /dev/sda1
|
||||||
|
|
||||||
|
|
||||||
If you get a warning like “contains an exfat file system - Proceed anyway? (y,N)”, type:
|
|
||||||
|
|
||||||
y
|
|
||||||
|
|
||||||
|
|
||||||
You should see output ending with success and a UUID.
|
You should see output ending with success and a UUID.
|
||||||
|
|
||||||
4. Grab the UUID and create the extroot fstab entry
|
4. Grab the UUID and create the extroot fstab entry
|
||||||
UUID=$(block info | awk -F\" '/sda1/ {print $2}')
|
UUID=$(block info | awk -F\" '/sda1/ {print $2}')
|
||||||
echo $UUID
|
echo $UUID
|
||||||
|
|
||||||
|
|
||||||
Sample UUID output:
|
Sample UUID output:
|
||||||
|
|
||||||
4851f00e-696b-47d3-a529-82c2aca292db
|
4851f00e-696b-47d3-a529-82c2aca292db
|
||||||
|
|
||||||
|
|
||||||
Now write the minimal extroot config using uci:
|
Now write the minimal extroot config using uci:
|
||||||
|
|
||||||
uci set fstab.extroot="mount"
|
uci set fstab.extroot="mount"
|
||||||
@@ -88,7 +54,6 @@ uci set fstab.extroot.fstype="ext4"
|
|||||||
uci set fstab.extroot.enabled="1"
|
uci set fstab.extroot.enabled="1"
|
||||||
uci commit fstab
|
uci commit fstab
|
||||||
|
|
||||||
|
|
||||||
Sanity-check the file:
|
Sanity-check the file:
|
||||||
|
|
||||||
cat /etc/config/fstab
|
cat /etc/config/fstab
|
||||||
@@ -111,15 +76,8 @@ config mount 'extroot'
|
|||||||
option enabled '1'
|
option enabled '1'
|
||||||
|
|
||||||
|
|
||||||
Not included:
|
|
||||||
|
|
||||||
No /rwm mount
|
|
||||||
|
|
||||||
No copy of internal overlay
|
|
||||||
|
|
||||||
This is a clean, SD-only overlay setup.
|
|
||||||
|
|
||||||
5. Reboot into extroot
|
5. Reboot into extroot
|
||||||
|
|
||||||
reboot
|
reboot
|
||||||
|
|
||||||
Wait for the router to come back up, then SSH in again.
|
Wait for the router to come back up, then SSH in again.
|
||||||
@@ -140,26 +98,10 @@ overlayfs:/overlay 468.3G 2.1M 444.4G 0% /
|
|||||||
Explanation:
|
Explanation:
|
||||||
|
|
||||||
/dev/root at /rom → read-only squashfs from flash
|
/dev/root at /rom → read-only squashfs from flash
|
||||||
|
|
||||||
/dev/sda1 at /overlay → SD card is the writable layer
|
/dev/sda1 at /overlay → SD card is the writable layer
|
||||||
|
|
||||||
overlayfs:/overlay on / → full rootfs = ROM + SD overlay
|
overlayfs:/overlay on / → full rootfs = ROM + SD overlay
|
||||||
|
|
||||||
You now have a 468 GB OpenWrt box.
|
You now have a 468 GB OpenWrt box.
|
||||||
|
|
||||||
Extra checks (optional)
|
No /rwm mount
|
||||||
mount | grep sda1
|
No copy of internal overlay
|
||||||
mount | grep overlay
|
This is a clean, SD-only overlay setup.
|
||||||
|
|
||||||
|
|
||||||
Should return:
|
|
||||||
|
|
||||||
/dev/sda1 on /overlay type ext4
|
|
||||||
overlayfs:/overlay on / type overlay
|
|
||||||
|
|
||||||
7. Quick functional test
|
|
||||||
opkg install tcpdump
|
|
||||||
df -h /overlay
|
|
||||||
|
|
||||||
|
|
||||||
You should see a small increase in Used for /dev/sda1, proving packages are installed to SD-backed overlay—not internal flash.
|
|
||||||
Reference in New Issue
Block a user