Resize eMMC partition and Attended Sysupgrade


I'm currently using CMCC RAX3000M eMMC version.

It comes in two versions, one with 128 MiB NAND and one with 64 GiB eMMC. In order to make the firmware common between the two versions, the contributor also set the same partition size for the eMMC version as the NAND version: 104 MiB.

Disk /dev/mmcblk0: 120832000 sectors, 57.6 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 5452574F-2211-4433-5566-778899AABB00
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 120831966
Partitions will be aligned on 1-sector boundaries
Total free space is 1799136 sectors (878.5 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            8192            9215   512.0 KiB   8300  ubootenv
   2            9216           13311   2.0 MiB     8300  factory
   3           13312           21503   4.0 MiB     EF00  fip
   4           24576           90111   32.0 MiB    EF00  recovery
   5          131072          344063   104.0 MiB   FFFF  production
   6         2097153         4194303   1024.0 MiB  8300  swap
   7         4194304       120829951   55.6 GiB    8300  data
 128              34            8191   4.0 MiB     EF02

(The swap and data partitions were created by myself)

The problem is: 104 MiB is too small, which makes it impossible to install more packages even if the eMMC version has a lot of unused space.

I remember that the rootfs size of OpenWrt seems to be determined at build time? This means that I cannot resize the production partition to use more space and must build the image myself. Then I can't use the default Attended Sysupgrade service either, right?

Best regards,


I recently performed this type operation on my BPI-R3.
I will have to find the procedure I used and update.
Though, I don't think it will exactly match to your device?

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 5888      5888         0 100% /rom
tmpfs                  1020704     17008   1003696   2% /tmp
/dev/mmcblk0p66        7327000    251132   7075868   3% /rom/overlay
overlayfs:/overlay     7327000    251132   7075868   3% /
tmpfs                      512         0       512   0% /dev
/dev/sda1             29818732    138200  28140492   0% /mnt/sda1

Not sure it will help you on your target, but here's what I do on x64.

First, install some utilities and the script resizing the root partition and root filesystem:

opkg update && opkg install parted losetup resize2fs
wget -U "" -O ""
. ./

Next, run the script you just installed:

sh /etc/uci-defaults/70-rootpt-resize

Your device will reboot, possibly twice, and once that is done, your root partition and filesystem will be expanded to the max. Now you can install Attended Sysupgrade, and when you run it, your root partition and root filesystem will be resized again as a part of the upgrade.

Alternatively, you could use Firmware Selector to make your own firmware capable of expanding the root partition and root filesystem on first run:

Just add the packages you need (be sure to include parted, losetup, and resize2fs) and copy and paste the resize script from the wiki into the Script to run on the first boot input. Then launch the build and, once it's complete, download your firmware...

1 Like

OK, thank you very much for your help, I'll check it out.

It seems that the GPT layout is a template parameter, so this is not set by the contributor.

Keep looking.

I resized my BPI-R3 via the following method:

1 Like

I tried to add Samba in the 'installed packages but the 'how to' looks like Samba needs to be installed incrementally?. Because I'd just add it to the list in 'installed packages and not need to expand the partition.

I'm also trying to expand the partition (because samba is a large package with lots of dependences) but that cli you just spelled out in indecipherable to me as I see no parameters. Do those commands just resize the appropriate partitions without specifying the partitions' sizes?

This may be a good choice.

Currently, Attended Sysupgrade doesn't preserve uci-defaults scripts (even those in the current firmware image itself), - that means there will be no /etc/uci-defaults/70-rootpt-resize script after upgrade so no more resizes?

Am I missing something?

May I have the instructions for installing official OpenWrt to my RAX3000M EMMC version? Thank you so much!;a=commit;h=423186d7d8b4f23aee91fca4f1774a195eba00d8