Cannot resize my root partition on BPI R3

Hello,

I am looking to extend the basic partition on the BPI R3. I managed to write the image (OpenWRT snapshot https://downloads.openwrt.org/snapshots/targets/mediatek/filogic/) to the internal eMMC memory without any problem. Only, the root partition storage space is ridiculous compared to the actual eMMC memory capacity.

I tried several methods without success. I can’t resize the partition properly. With parted, I managed to change the size of the “/dev/mmcblk0p5” volume.

Old :

image

Actually :

image

But, available space is not correct :

image

Can you help me ? I haven’t found anything that helps me…

Thank you.

You have to resize filesystem too,not only change partition table. Command depends on filesystem type.

You need to resize the filesystem in the (now bigger) /dev/mmcblk0p66 (which is split-off from /dev/mmcblk0p5).

But why do you like to add the remains space to the root filesystem in first place? As rootfs overlay is re-created ever time you upgrade the system imho it doesn’t make sense to keep anything big there anyway. It’s much better to create additional volumes, e.g. using uvol or by simply creating one large additional partition.

What command should I use to resize the filesystem? Because resizefs.f2fs doesn’t work… Do I also need to modify the /dev/mmcblk0p66 partition? I don’t clearly understand what I should do. Some tutorials explain differently and I can’t figure out what actually applies to the R3 model.

I’ve also tried creating another partition and mounting it elsewhere (extroot: https://openwrt.org/docs/guide-user/additional-software/extroot_configuration) but that doesn’t work either. The partition is never mounted over the other and the displayed partition size always remains the same.

On the R3 the /dev/mmcblk0p66 device is automatically mapped as the remaining space on /dev/mmcblk0p5 after parsing the uImage.FIT for kernel, device tree and read-only squashfs rootfs (squashfs filesystem is mapped as /dev/mmcblk0p65). So those p65 and p66 partitions are not actual GPT partitions but rather p65 is the filesystem sub-image of the uImage.FIT stored in p5 and p66 is the remaining space on p5 after the uImage.FIT.

Hence you only need to edit the size of /dev/mmcblk0p5, then reboot, then use resizefs.f2fs with /dev/mmcblk0p66 which will automatically reflect the changed size of the /dev/mmcblk0p5 partition after reboot.

For extroot to work you need to install block-mount (or better to deal also with removable media: install blockd).

In general I’d still recommend you to install uvol which allows you to manage additional storage volumes more easily. In order to automatically allocate all unused storage on the device used to boot and store the root filesystem you can install the autopart package.

Sidenote: The first part of your post is in French and you should write in English here.

Sorry, it’s a mistake… I started writing in French then I came back later to finish writing my text before posting it…

Great ! autopart saved me and you too :rofl:

I will try other configurations to see if everything is ok.

Everything is okay !

For others : Boot in recovery or on nand (jumpers in H L H L [NAND] or L H H L [eMMC])

Install “parted” (“opkg install parted”)

Use parted to resize partitions 3 and 4 to the right size (that the sectors follow each other because there are empty spaces between the partitions).

Resize partition 5, the system will indicate that the disk (GPT) does not have its maximum size, “fix” and resize the partition to the maximum of its value (“unit s” [sectors], “print free” [show free space after last partition], “resizepart” then enter partition number [5], ending size [15269854s] in my case).

Then quit and install “autopart” (“opkg install autopart”), I don’t know what is used by autopart at the end, but it takes care of refreshing the partition size which will be at the correct dimension after reboot.

Thanks @dangowrt :+1::kissing_heart:

For what you are doing you don’t even need autopart (which would try to use the remaining space you have now already allocated to the production partition).

Yes, in my case it did nothing since there was no more space available at the end of the disk (no error, no message).

Without using autopart, on restart, I did not see the total space but always about 100MB. I think it’s running a command to refresh the partitions or something.

In case you are building OpenWrt from source, the size of the production partition can also be defined in menuconfig:

screenshot

This sets the configuration variable CONFIG_TARGET_ROOTFS_PARTSIZE in .config which you can also edit when using the ImageBuilder.

1 Like