Resize EMMC OpenWrt 24.10

Hi. To resize EMMC partition on a BPI R3 I used:

opkg update
opkg install parted
parted /dev/mmcblk0
print
resizepart 5 7G
reboot
mount /dev/mmcblk0p66 /mnt
umount /dev/mmcblk0p66
resize.f2fs -s /dev/mmcblk0p66
poweroff

But in OpenWrt 24.10 there’s no /dev/mmcblk0p66.

What is the proper way to resize EMMC partition on OpenWrt 24.10? Thanks

Ok. I’m going to answer myself.

Flash NAND → Flash EMMC → Start on NAND → cfdisk /dev/mmcblk0 → Resize /dev/mmcblk0p5

Start on EMMC and everything is ok.

1 Like

This aproach I try without success. Everytime I get info “Cannoct do this on mounted FS”

You have to do it starting OpenWrt from NAND.

Thanks, I will try it. Thats a good point.

This was very usefull:

Flash NAND → Flash EMMC → Start on NAND → cfdisk /dev/mmcblk0 → Resize /dev/mmcblk0p5

On emmc I really see partition of 7.2GB:

mmcblk0      179:0    0   7.3G  0 disk 
├─mmcblk0p1  179:1    0     4M  0 part 
├─mmcblk0p2  179:2    0   512K  0 part 
├─mmcblk0p3  179:3    0     2M  0 part 
├─mmcblk0p4  179:4    0     4M  0 part 
├─mmcblk0p5  179:5    0    32M  0 part 
└─mmcblk0p6  179:6    0   7.2G  0 part 
mmcblk0boot0 179:8    0     4M  1 disk 
mmcblk0boot1 179:16   0     4M  1 disk 
ubiblock0_4  254:0    0  16.3M  0 disk 
fit0         259:0    0  10.8M  1 disk /rom
fitrw        259:1    0   7.2G  0 disk /overlay

But when I log to Luci, it still show 429MB.

df -h:

Filesystem                Size      Used Available Use% Mounted on
/dev/root                11.0M     11.0M         0 100% /rom
tmpfs                     1.9G    288.0K      1.9G   0% /tmp
/dev/fitrw              429.7M     85.6M    344.1M  20% /overlay
overlayfs:/overlay      429.7M     85.6M    344.1M  20% /
tmpfs                   512.0K         0    512.0K   0% /dev

What could be wrong ? Thank you.

I guess,you resized partition but not the filesystem

The first time I tried, the same thing happened to me on BPI-R3. And it was because participation /dev/mmcblk0p5 must be increased before openwrt has ever started on Emmc.

So should I make fresh install of openwrt from SD card? Flash to - nand and then to emmc and then resize partition on emmc from NAND? And then finally boot from emmc ?

Yes, that’s right the way I did It for BPI-R3. Rebember you’ll need cfdisk package on your OpenWrt image.

Ok, thank you a lot. I will install all needed package on NAND. I will try it and let you know about my result.

Hello, I try it all possible working scenario. I even try delete the partition “5” and create it again with cfdisk at NAND mode. After switch to eMMC I was and with “initramfs” recovery mode. I think resize openwrt over full flash eMMC is currently impossible. I found many question on openwrt forum withou solution. Maybe something will change when they release opnwrt 25… Thank you all for helping me.

Example

Have you increased filesystem too? Not only partition…

This shot is from a BPI-R3 with OpenWrt 24.10 and a 7,2 GiB emmc partition, extended with cfcdik. Unfortunatey, I don’t know what might happen with BPI-R4.

SOLVED

What worked for me required an extra step. Here’s a detailed guide with all steps explicit for first-timers:

  1. write bananapi_bpi-r4-sdcard.img.gz to an sd card (unzip first) or whatever version is current.
  2. Boot from sdcard (SW3 pins to 1,1).
  3. connect a serial adapter, far easier than manually setting default boot options with fw_setenv commands, and you see the boot process. Also my BPI-R4 came with a serial adapter that’s pretty good.
  4. in the boot menu chose “9. Install bootloader, recovery and production to NAND.” (@Miles28 calls this step Flash NAND).
  5. boot to NAND (SW3 pins to 0,1) (remove power cable and then change pins)
  6. in the boot menu chose “9. Install bootloader, recovery and production to EMMC.” (@Miles28 calls this step Flash EMMC).
  7. then continue to boot in NAND
  8. install cfdisk and cfdisk /dev/mmcblk0 → Resize /dev/mmcblk0p5 to something like 7.2G. This can be done with gdisk, parted, fdisk, yet cfdisk is easiest.
  9. I couldn’t make use of resize.f2fs - mmcblk0p5 is not an F2FS partition, but something that becomes /dev/fit0 and /dev/fitrw, the second is an F2FS partition. But the process eludes me, so i don’t know how to resize fitrw. My second idea is to hope the first boot on EMMC will resize fitrw automatically.
  10. boot to EMMC (SW3 pins to 1,0) (remove power cable and then change pins)
  11. I expected fitrw to be 7.2G, yet it was 428MB. So the auto resizing fails.
  12. What fixed it for me was to boot in EMMC and then umount /dev/fitrw and firstboot -y. If you don’t umount first, fitrw survives, see logs below.

Relevant logs:

unsuccessful attempt

root@OpenWrt:~# firstboot -y
/dev/fitrw is mounted as /overlay, only erasing files

See how it only erases the files. That is not enough - fitrw survives with the old size.

successful attempt:

root@OpenWrt:~# umount /dev/fitrw
root@OpenWrt:~# firstboot -y
/dev/fitrw is not mounted
/dev/fitrw will be erased on next mount

See how fitrw will be erased “on next mount”? This is what makes the resizing work. Note: Of course in all cases you lose all your rw data, but that is expected.

dmesg logs:

[   10.333417] mount_root: overlay filesystem in /dev/fitrw has not been formatted yet
[   11.268669] F2FS-fs (fitrw): Found nat_bits in checkpoint
[   11.302163] F2FS-fs (fitrw): Mounted with checkpoint version = d70cacb
[   11.309183] mount_root: overlay filesystem has not been fully initialized yet
[   11.316582] mount_root: switching to f2fs overlay
[   11.322343] overlayfs: null uuid detected in lower fs '/', falling back to xino=off,index=off,nfs_export=off.

I think here fitrw is created

df -h

Filesystem                Size      Used Available Use% Mounted on
/dev/root                11.0M     11.0M         0 100% /rom
tmpfs                     1.9G    444.0K      1.9G   0% /tmp
/dev/fitrw                7.2G    191.8M      7.0G   3% /overlay
overlayfs:/overlay        7.2G    191.8M      7.0G   3% /
tmpfs                   512.0K         0    512.0K   0% /dev

I still don’t understand how this fitrw is created from the partition. If someone can explain, I’d be grateful.

1 Like