Expand Root Script Not Working on OpenWRT 24.10.0 (Raspberry Pi 5)

Hi everyone,

I'm trying to expand my root filesystem on OpenWRT 24.10.0 using the official script from the OpenWRT documentation:
:link: [Expand Root Filesystem Guide]

However, when I run the script on my Raspberry Pi 5, the system reboots and never recovers. After rebooting, I can’t access OpenWRT, and it seems like the system is completely unbootable.

Device Details:

  • Device: Raspberry Pi 5
  • OpenWRT Version: 24.10.0
  • Storage: 32GB MiroSD

Issue:

  • Ran the script as per the OpenWRT Wiki guide
  • Raspberry Pi reboots automatically
  • After reboot, OpenWRT does not start (no access via SSH or web UI)

Has anyone else faced this issue? Is there a fix or an alternative method to safely expand the root filesystem on OpenWRT 24.10.0?

Thanks!

Try Gparted in another machine.

It is as easy as sliding the partition you want expanded, using a gui.
Use it after the flash and before you first boot.

1 Like

Wonder what sets the root= to the partition id. I have this every time I sysupgrade, it reverts back after I changed it. I use the scripts too. I can't see where the script would update this.

Edit

1st and 6th result looks interesting.

Google suggests partuuid is based on the sector start/end so changes when you resize the partition. Could perhaps get the new partuuid and replace it in the cmdline.txt with something like

NEW_UUID=`blkid ${ROOT_DISK}p${ROOT_PART} | sed -n 's/.*PARTUUID="\([^"]*\)".*/\1/p'`
sed -i "s/PARTUUID=[^ ]*/PARTUUID=${NEW_UUID}/" /boot/cmdline.txt

This could be added after the line "touch /etc/rootpt-resize" in the first script on https://openwrt.org/docs/guide-user/advanced/expand_root. I will test this out tomorrow maybe.

I am running a Raspberry Pi 5 2GB with 2.5Gb-Ethernet-Hat with a 2TB-NVME-SSD and a 1GB-Ethernet-Dongle with Samba, Docker and Media Server .

I first Customized Snapshot Build with:
r8169-firmware kmod-r8169 kmod-usb-net-cdc-ether kmod-usb-net kmod-usb-net-rtl8152 parted blkid nano losetup resize2fs tune2fs

I second login to 192.168.1.1
configure Wan & Lan to get Internet

I third login to the new created 192.168.2.1

ssh-keygen -R 192.168.2.1
ssh root@192.168.2.1

I forth resize Partition SD:

$ apk update
$ parted -f -s /dev/mmcblk0 resizepart 2 100%
$ parted -l -s
$ blkid
$ nano /boot/partuuid.txt
(Change UUID)
$ nano /boot/cmdline.txt
(Change UUID)
reboot

$ mount -o remount,ro /
$ tune2fs -O^resize_inode /dev/mmcblk0p2
$ e2fsck -f /dev/mmcblk0p2
$ resize2fs /dev/mmcblk0p2
reboot

This modification to the script seems to work for me, the sysupgrade went through without any issues. I will test it out a bit more tomorrow.

@jafartayyar, maybe you could test it on your pi5?

Based on your solution, here is the step by step guid that worked for me:

1. Edit cmdline.txt

  1. Remove the microSD card from the Raspberry Pi and insert it into another computer.
  2. Mount the boot partition and edit cmdline.txt:
sudo nano /mnt/cmdline.txt
  1. Change this line:
root=PARTUUID=661a1cf7-02

to:

root=/dev/mmcblk0p2
  1. Save the file and put the microSD card back into the Raspberry Pi.

2. Boot into OpenWRT and Install Necessary Packages

  1. Power on the Raspberry Pi and SSH into OpenWRT.
  2. Update package lists:
opkg update
  1. Install required packages:
opkg install parted losetup resize2fs

3. Download and Modify the Expansion Script

  1. Download the official expand-root.sh script:
wget -U "" -O expand-root.sh "https://openwrt.org/_export/code/docs/guide-user/advanced/expand_root?codeblock=0"
  1. Open the script for editing:
nano expand-root.sh
  1. After the line:
touch /etc/rootpt-resize

Add the following code:

NEW_UUID=`blkid ${ROOT_DISK}p${ROOT_PART} | sed -n 's/.*PARTUUID="\([^"]*\)".*/\1/p'`
sed -i "s/PARTUUID=[^ ]*/PARTUUID=${NEW_UUID}/" /boot/cmdline.txt
  1. Save and exit the file.

4. Run the Expansion Script

  1. Execute the script:
. ./expand-root.sh
  1. Run the partition resize script manually:
sh /etc/uci-defaults/70-rootpt-resize

5. System Reboot and Completion

  • The Raspberry Pi will reboot after a few minutes.
  • Once it comes back online, your root filesystem should be successfully expanded!
1 Like

After step 5, the scripts will persist and you won't need to do this exercise again in theory!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.