Formatting
This commit is contained in:
111
extroot.txt
111
extroot.txt
@@ -1,27 +1,26 @@
|
|||||||
OpenWrt 24.x Extroot on XE300
|
OpenWrt 24.x Extroot on XE300
|
||||||
|
|
||||||
Goal: Use a 512 GB microSD card as the router’s writable storage (overlay),
|
Goal: Use a 512 GB microSD card as the router's writable storage (overlay),
|
||||||
single ext4 partition, no data copied from internal flash.
|
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.x, fresh flash
|
OpenWrt: 24.x, fresh flash
|
||||||
|
|
||||||
SD card in the built‑in slot
|
SD card location: built-in slot
|
||||||
|
|
||||||
The card appears as /dev/sda with one partition /dev/sda1
|
Detected as: /dev/sda with one partition /dev/sda1
|
||||||
|
|
||||||
You don’t care about any existing data on the card or in the old overlay
|
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.
|
Insert the microSD card.
|
||||||
|
SSH into the router (root@192.168.x.x, etc).
|
||||||
|
|
||||||
SSH into the router (root@192.168.x.x etc).
|
Install the extroot-related packages:
|
||||||
|
|
||||||
Install the packages that make extroot possible:
|
|
||||||
|
|
||||||
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
|
||||||
@@ -29,65 +28,58 @@ opkg install block-mount kmod-fs-ext4 kmod-usb-storage e2fsprogs
|
|||||||
|
|
||||||
What they do:
|
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 – gives you mkfs.ext4
|
e2fsprogs - provides mkfs.ext4
|
||||||
|
|
||||||
2. Confirm the SD card is detected as /dev/sda//dev/sda1
|
2. Confirm the SD card is /dev/sda and /dev/sda1
|
||||||
|
|
||||||
Check dmesg:
|
Check dmesg:
|
||||||
|
|
||||||
dmesg | grep -i sd
|
dmesg | grep -i sd
|
||||||
|
|
||||||
|
|
||||||
On your XE300 you should see something like:
|
On the XE300 you should see:
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
That tells you:
|
This tells you:
|
||||||
|
|
||||||
Disk: /dev/sda
|
Disk: /dev/sda
|
||||||
|
|
||||||
Partition already present: /dev/sda1
|
Partition already present: /dev/sda1
|
||||||
|
|
||||||
If you don’t see sda1 for some reason in the future, you’d need to create a partition—but on your current setup, it’s there already, so we can jump straight to formatting.
|
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
|
||||||
|
|
||||||
We’re going to erase whatever is on that partition and build a fresh ext4 FS.
|
|
||||||
|
|
||||||
mkfs.ext4 -L extroot /dev/sda1
|
mkfs.ext4 -L extroot /dev/sda1
|
||||||
|
|
||||||
|
|
||||||
You may get a warning like “contains an exfat file system – Proceed anyway? (y,N)”
|
If you get a warning like “contains an exfat file system - Proceed anyway? (y,N)”, type:
|
||||||
|
|
||||||
Answer y
|
y
|
||||||
|
|
||||||
You should see output about creating the filesystem, ending with success and a UUID.
|
|
||||||
|
|
||||||
At this point /dev/sda1 is a clean ext4 filesystem labeled extroot.
|
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
|
||||||
|
|
||||||
Ask OpenWrt’s block layer for info and capture the UUID:
|
|
||||||
|
|
||||||
UUID=$(block info | awk -F\" '/sda1/ {print $2}')
|
UUID=$(block info | awk -F\" '/sda1/ {print $2}')
|
||||||
echo $UUID
|
echo $UUID
|
||||||
|
|
||||||
|
|
||||||
You should see a UUID like:
|
Sample UUID output:
|
||||||
|
|
||||||
4851f00e-696b-47d3-a529-82c2aca292db
|
4851f00e-696b-47d3-a529-82c2aca292db
|
||||||
|
|
||||||
|
|
||||||
Now write the minimal extroot config via UCI:
|
Now write the minimal extroot config using uci:
|
||||||
|
|
||||||
uci set fstab.extroot="mount"
|
uci set fstab.extroot="mount"
|
||||||
uci set fstab.extroot.uuid="$UUID"
|
uci set fstab.extroot.uuid="$UUID"
|
||||||
@@ -97,86 +89,77 @@ 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
|
||||||
|
|
||||||
|
|
||||||
Expected content (plus the global section):
|
Expected output:
|
||||||
|
|
||||||
config global
|
config global
|
||||||
option anon_swap '0'
|
option anon_swap '0'
|
||||||
option anon_mount '0'
|
option anon_mount '0'
|
||||||
option auto_swap '1'
|
option auto_swap '1'
|
||||||
option auto_mount '1'
|
option auto_mount '1'
|
||||||
option delay_root '5'
|
option delay_root '5'
|
||||||
option check_fs '0'
|
option check_fs '0'
|
||||||
|
|
||||||
config mount 'extroot'
|
config mount 'extroot'
|
||||||
option uuid '4851f00e-696b-47d3-a529-82c2aca292db'
|
option uuid '4851f00e-696b-47d3-a529-82c2aca292db'
|
||||||
option target '/overlay'
|
option target '/overlay'
|
||||||
option fstype 'ext4'
|
option fstype 'ext4'
|
||||||
option enabled '1'
|
option enabled '1'
|
||||||
|
|
||||||
|
|
||||||
Note what’s not there:
|
Not included:
|
||||||
|
|
||||||
No /rwm mount
|
No /rwm mount
|
||||||
|
|
||||||
No copy of internal overlay
|
No copy of internal overlay
|
||||||
|
|
||||||
This is intentionally a clean, single‑overlay setup that lives entirely on the SD card.
|
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.
|
||||||
Let the router come back up and SSH in again.
|
|
||||||
|
|
||||||
6. Verify that the SD card is now your root overlay
|
6. Verify that the SD card is now your root overlay
|
||||||
|
|
||||||
Run:
|
|
||||||
|
|
||||||
df -h
|
df -h
|
||||||
|
|
||||||
|
Expected output:
|
||||||
On your working system, you got:
|
|
||||||
|
|
||||||
Filesystem Size Used Available Use% Mounted on
|
Filesystem Size Used Available Use% Mounted on
|
||||||
/dev/root 4.0M 4.0M 0 100% /rom
|
/dev/root 4.0M 4.0M 0 100% /rom
|
||||||
tmpfs 58.7M 200.0K 58.5M 0% /tmp
|
tmpfs 58.7M 200.0K 58.5M 0% /tmp
|
||||||
/dev/sda1 468.3G 2.1M 444.4G 0% /overlay
|
/dev/sda1 468.3G 2.1M 444.4G 0% /overlay
|
||||||
overlayfs:/overlay 468.3G 2.1M 444.4G 0% /
|
overlayfs:/overlay 468.3G 2.1M 444.4G 0% /
|
||||||
|
|
||||||
|
|
||||||
Interpreting that:
|
Explanation:
|
||||||
|
|
||||||
/dev/root at /rom → the read‑only squashfs from flash (normal)
|
/dev/root at /rom → read-only squashfs from flash
|
||||||
|
|
||||||
/dev/sda1 mounted at /overlay → SD card is the writable layer
|
/dev/sda1 at /overlay → SD card is the writable layer
|
||||||
|
|
||||||
overlayfs:/overlay mounted on / → your whole root filesystem is now the ROM + SD overlay
|
overlayfs:/overlay on / → full rootfs = ROM + SD overlay
|
||||||
|
|
||||||
That’s exactly what we want: the router is effectively a 468 GB OpenWrt box.
|
You now have a 468 GB OpenWrt box.
|
||||||
|
|
||||||
Extra checks if you ever want them:
|
|
||||||
|
|
||||||
|
Extra checks (optional)
|
||||||
mount | grep sda1
|
mount | grep sda1
|
||||||
mount | grep overlay
|
mount | grep overlay
|
||||||
|
|
||||||
|
|
||||||
Should show:
|
Should return:
|
||||||
|
|
||||||
/dev/sda1 on /overlay type ext4
|
/dev/sda1 on /overlay type ext4
|
||||||
|
|
||||||
overlayfs:/overlay on / type overlay
|
overlayfs:/overlay on / type overlay
|
||||||
|
|
||||||
7. Quick functional test
|
7. Quick functional test
|
||||||
|
|
||||||
Just to flex:
|
|
||||||
|
|
||||||
opkg install tcpdump
|
opkg install tcpdump
|
||||||
df -h /overlay
|
df -h /overlay
|
||||||
|
|
||||||
|
|
||||||
You’ll see a tiny bump in “Used” on /dev/sda1, confirming packages are being installed to SD‑backed overlay, not the tiny internal flash.
|
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