This is for new people who want to increase their system space to 512MB and use the rest of your SD card (Example here 64GB) for storage:
Step 1: Install Necessary Tools
apk update
apk add parted resize2fs f2fs-tools fdisk
- parted: Resizes the partition "walls."
- resize2fs: Stretches the actual filesystem to fit the new walls.
- f2fs-tools: Allows you to format the remaining 59GB.
- fdisk: For verification
Step 2: Prepare the Expansion Script
- Use an official script to automate the resizing logic
wget -U "" -O expand-root.sh "https://openwrt.org/_export/code/docs/guide-user/advanced/expand_root?codeblock=0"
. ./expand-root.sh
This creates a temporary "startup task" that resizes the disk safely during the next boot.
Step 3: Set the 512MB Limit
By default, the script takes the whole card. We must tell it to stop at 584MiB (72MB Start + 512MB Size).
sed -i 's/100%/584MiB/' /etc/uci-defaults/70-rootpt-resize
This ensures your system stays at 512MB, leaving the rest of the 64GB card free for your data partition. Also we added the resize script to /etc/sysupgrade.conf, OpenWrt will remember our 512MB limit even after you upgrade to a newer version. It won't accidentally expand and overwrite your 59GB data partition!
Step 4: Apply and Reboot
- Run the trigger script. Your Pi will reboot twice.
sh /etc/uci-defaults/70-rootpt-resize
Note: Wait 2 minutes. The first reboot resizes the partition; the second resizes the filesystem.
Step 5: Create the Data Partition
- Now use the remaining ~59GB for a separate storage area.
# Create the partition wall
parted -a optimal -s /dev/mmcblk0 mkpart primary f2fs 584MiB 100%
# Format it so you can save files
mkfs.f2fs -l storage /dev/mmcblk0p3
Step 6: Final Setup in LuCI (Web Interface)
- Go to System > Mount Points.
- Find Mount Points and click Add.
- UUID: Select the one ending in /dev/mmcblk0p3.
- Mount Point: Type
/sda0
- Save & Apply, then reboot one last time.
Step 7: Confirm Your Work
- Verify that all partitions are correctly sized and recognized by the system.
fdisk -l /dev/mmcblk0
- mmcblk0p2: Should now end near 584M (your 512MB system partition).
- mmcblk0p3: Should show the remaining ~59G (your data partition).
===========================================
Future Upgrade Steps
- Backup: Download your settings from System > Backup.
- Upgrade: During sysupgrade make sure these packages are present:
parted, resize2fs, f2fs-tools.
If these are missing, the automated resize script will fail and may brick your router.
- Restore: Upload your backup file and let the router reboot.
- Verify Partition: Run
fdisk -l /dev/mmcblk0.
- If
p3 exists: Go to Mount Points and re-add it.
- If
p3 is missing: Run parted -a optimal -s /dev/mmcblk0 mkpart primary f2fs 584MiB 100%.
- Final Mount: Enable the partition in LuCI under Mount Points.