Expanding root soft-bricks Raspberry Pi 5

I am trying to run the snapshot on rpi5, but i cant figure out how to expand the root successfully.

Flashing the OS works fine, and boots fine with ~100Mb root fs.

I have tried following https://openwrt.org/docs/guide-user/advanced/expand_root#automated;

on other devices I have to run . ./expand-root.sh and then sh /etc/uci-defaults/70-rootpt-resize, at which point the devices reboot with the root expanded.

I have also tried using GParted on another ubuntu machine.

Both result in the pi not booting.

Has anyone successfully expanded the root fs on the rpi5?

I have not done this with a 5 but I find gparted in cli tedious.

and there is the issue of making a mistake on an SD card (or anything ,really) not being overwritten; so they persist re-flashing.

I suggest you scrub the memory device (SD card?) with a RPi OS flash, flash it again with the OpenWrt firmware selector and then use the GUI gparted in your ubuntu machine; unmount the memory device in the drop-down and then, using the GUI, expand.

yup; done this exactly so many times today i cant count. All fails to boot.

  1. use balena etcher to flash the SD (on windows; but i doubt that matters)
  2. use card reader on ubuntu; umount /dev/sdb
  3. use gparted GUI; resize partition and apply changes
  4. fails to boot

im not an expert, but im also not a beginner and ive never had this problem on pi cm4, nanopi r4s, pi 4B, etc.

all of these approaches result in failure to boot:

  1. gparted gui
  2. script here (that works on cm4, nanopi r4s, rpi4b): https://openwrt.org/docs/guide-user/advanced/expand_root#automated
  3. even the following, run in an ssh term on fresh install results in failure to boot:
# Install packages
opkg update
opkg install parted
 
# Identify disk name and partition number
parted -l -s
 
# Expand root partition
parted -f -s /dev/mmcblk0 resizepart 2 100%
 
# Apply changes
reboot

(note on 3): it fails to boot there after expanding the partition; even before expanding the root fs

Try doing that in the GUI drop down menu. Just be sure you have selected the correct device. :wink:

I use the Raspberry Pi imager; don't know if that makes a difference though.

@KSofen, any advice?

1 Like

i mean... does the dropdown do something additional to umount?

anyways; no change using Partition>Unmount GUI menu. still dead, no boot.

im going to look for another sd card just to eliminate the possibility of a DOA sd card. it was new in the package, but sd cards, ya know?

Have a look at https://github.com/openwrt/openwrt/commit/fe0081eecf43bfd92ac68aa0f3ce7165aaddb4f2
You might need to update the cmdline partuuid

I don't know Linux well enough to discriminate GUI vs CLI; just seems more consistent

So right...

I just switched to an Industrial grade card because the controller wear-leveling is OS independent and there is more over-provisioning; among other things.

Why expand the root partition? It's only used to boot. Flash an ext4 image and before you put try to use the Pi, on a separate computer mount the sd card

run: lsblk and note the first sector of the small overlay partition.
run: fdisk /dev/sdb

p, d, 2, n, p, 2, n, w (be sure to start the large partition at the same point the smaller one as detected above with lsblk - it will automatically select the endpoint and fill the available space.)

run: e2fsck -f /dev/sdb2

run: resize2fs /dev/sdb2

remove the sd card and boot in the pi

2 Likes

Because i need to run docker; but i cant even install it

So sorry for not doing my homework...

Bro:
I only see a snapshot for Pi5 and it is not fully supported yet.
I, thought it was in full support.

Sorry about that.

1 Like

That's correct.

I would suggest you to build your own rpi5 image if you are planning to use docker, manually expanding the fs and installing all packages from the openwrt snapshot is tedious. easiest method is use the imagebuilder on your ubuntu machine
1- Install the imagebuilder perquisites https://openwrt.org/docs/guide-user/additional-software/imagebuilder
2- Build the the firmware with the folowing commands or paste all on the console

wget https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2712/openwrt-imagebuilder-bcm27xx-bcm2712.Linux-x86_64.tar.zst
tar -xf openwrt-imagebuilder-bcm27xx-bcm2712.Linux-x86_64.tar.zst
cd openwrt-imagebuilder-bcm27xx-bcm2712.Linux-x86_64
make image PROFILE=rpi-5 ROOTFS_PARTSIZE="1040" PACKAGES="luci luci-app-dockerman luci-app-filebrowser luci-app-ttyd block-mount blockd mount-utils btrfs-progs e2fsprogs kmod-fs-btrfs kmod-fs-ext4 docker docker-compose dockerd fdisk cfdisk kmod-usb-storage losetup kmod-usb-storage-extras kmod-usb-storage-uas kmod-usb-net-rtl8152 kmod-veth kmod-vxlan kmod-fs-xfs nano-full parted resize2fs xfs-mkfs xfs-fsck usbutils"

3- Flash the image to the SD card and boot
4- Create a new primary partition with cfdisk on the free space mmcblk0p3
cfdisk /dev/mmcblk0
5- Format the mmcblk0p3 partition
mkfs.btrfs /dev/mmcblk0p3
6- Mount the new partition on the overlay or as an external storage
mount /dev/mmcblk0p3 /overlay or mount /dev/mmcblk0p3 /sd1
also change the docker directory
/overlay/opt/docker/ or /sd1/opt/docker/

 -----------------------------------------------------
 OpenWrt SNAPSHOT, r26497-37ff0ea726
 -----------------------------------------------------
root@OpenWrt:/# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root              1006.0M    296.1M    693.8M  30% /rom
tmpfs                     3.9G    332.0K      3.9G   0% /tmp
/dev/mmcblk0p3          115.4G    199.3M    113.2G   0% /overlay
overlayfs:/overlay      115.4G    199.3M    113.2G   0% /
/dev/mmcblk0p1           63.9M     14.6M     49.3M  23% /boot
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mmcblk0p3          115.4G    199.3M    113.2G   0% /overlay/opt/docker
2 Likes

OpenWrt SNAPSHOT, r26497-37ff0ea726

root@OpenWrt:/# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 1006.0M 296.1M 693.8M 30% /rom
tmpfs 3.9G 332.0K 3.9G 0% /tmp
/dev/mmcblk0p3 115.4G 199.3M 113.2G 0% /overlay
overlayfs:/overlay 115.4G 199.3M 113.2G 0% /
/dev/mmcblk0p1 63.9M 14.6M 49.3M 23% /boot
tmpfs 512.0K 0 512.0K 0% /dev
/dev/mmcblk0p3 115.4G 199.3M 113.2G 0% /overlay/opt/docker

Wait,
What,
Huh?!?!

Did you just do that for show?!!!?

Okay...
Umm.
That would be spectacular.!
Almost, incredible.
If you really did that, just to help a snapshot...
...no really...
...I'm, practically, speechless.
Well done...

Thank you.

I appreciate you writing out the process.

We haven't gotten into building it ourselves. We are developing an embedded product and we would prefer to not have to build it but instead use the releases from openwrt.

I realize the rpi5 is still in snapshot territory and not supported at the time of this post. We wouldn't use a snapshot in production. We are just anxious to test the rpi5 we just got.

the issue I am trying to raise is that the script provided here: https://openwrt.org/docs/guide-user/advanced/expand_root

Seems to fail to expand the FS after expanding the partition, when it works for other (admittedly full release) platforms.

I don't expect a snapshot to be fully usable and stable, but the script above 1) works on other platforms and 2) the description is written in such a way that leads me to believe it should work. So if the info in the wiki link is incorrect, I'd be happy to commit changes if we can identify them together.

Wow...
You got your answer and now you *****fest it is not the answer you wanted...

So rude.

Next time you all want to change OpenWrt wiki, please post it in the developer's forum.

dont do that man. whats wrong?
Are you upset forum users are testing snapshots and posting in https://forum.openwrt.org/c/general/6? :man_shrugging: sorry to have triggered you, but im not even completely clear how i was rude. i learned a lot from this thread, @KSofen's instructions work well. and i might go to try building it myself now with my new knowledge.

Im working through the process of understanding what isnt working so we can contribute to an improvement. where would you prefer i do that?

All thanks go to @KSofen and @Ieo.

My instructions were very shortcut because I assumed you were already familiar with Linux since you were using gparted. I should probably write it out in more detail with some screen images.