[BPI-R3 Mini] How to extend eMMC overlayfs?

Dear all,

there is an official way to extend eMMC overlayfs? Currently stock OpenWrt has just 74MB

Thanks in advance

a small list of existing Threads

1 Like

looks like that most of these topic cannot work on latest OpenWrt. They are using UBI fit volume, and ubirsvol doesn’t work because volume was created before with a fixed size :frowning:

Need to figure out

looks like that fit partition has fixed size on dts

&spi0 {
	pinctrl-names = "default";
	pinctrl-0 = <&spi_flash_pins>;
	status = "okay";

	flash@0 {
		compatible = "spi-nand";
		#address-cells = <1>;
		#size-cells = <1>;
		reg = <0>;

		spi-max-frequency = <20000000>;
		spi-tx-bus-width = <4>;
		spi-rx-bus-width = <4>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
				label = "bl2";
				reg = <0x0 0x200000>;
				read-only;
			};

			partition@200000 {
				label = "ubi";
				reg = <0x200000 0x7e00000>;
				compatible = "linux,ubi";

				volumes {
					nand_rootdisk: ubi-volume-fit {
						volname = "fit";
					};
				};
			};
		};
	};
};

So it cannot be increase without recompile, only way is to move stuff on rootfs_data… not so good

Have you tried using the image builder for OpenWrt? Was also listed there in the links from Frank.

And then just set ROOTFS_PARTSIZE to whatever you want. (Overriding CONFIG_TARGET_ROOTFS_PARTSIZE in Image Builder - #5 by ericzhangjx - For Developers - OpenWrt Forum)

I’ll try later to build my own image and see… yesterday first attempt failed…

Thx for the hint

You want to increase emmc root,right? Youve pointed to nand partition in dts…

Yes but layout on eMMC seems the same, just two partitions (bl2/ubi), and inside UBI, the various volumes (and fit cannot be more than 101MB)

ok, compiled my own version changing rootfs size on menuconfig and now i’ve /overlay of 5.5G (rootfs set to 7128MB)

root@OpenWrt:/# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 8.5M      8.5M         0 100% /rom
tmpfs                   996.4M    180.0K    996.3M   0% /tmp
/dev/fitrw                5.5G    164.4M      5.3G   3% /overlay
overlayfs:/overlay        5.5G    164.4M      5.3G   3% /
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:/#

just for reference, if you choose to use Ext4 instead of SquashFS, build fails

I think ext4 is only working on x86 openwrt installations.

Isn’t it odd that you set it to 8GB and you only get 5GB? From the looks there is a 1GB temp fs and I assume there are also other partitions not visible here, like recovery, firmware and uboot.

Gonna try the same for my R4 next. Though only 1G or 0.5G for the root fs to make updates easier and smaller - AFAIK the size of the sysupgrade image is equal to that of your rootfs plus above extras.

I’d rather add another partition that is not affected by sysupgrade and put my data files, like container images, there.

yes, looks like that’s the way OpenWrt create UBI images… anyway this is a simple 5G router, I don’t need containers, just VPN and some useful app to manager 5G and VoLTE, all stuff is in /etc, so no worries about sysupgrade :slight_smile:

I think we should way next stable relese to see BPI-R3 Mini supported

I create a p6 and p7 partition labeled rootfs and rootfs_data .ext4 4.1 gb and 2 gb. Copy root.ext4 filesystem over, update uboot bootargs root=/dev/mmcblk0p6 ro or rw depending on updating fs from packages or config changes.

Will report if i leave it in rw, that it will get rooted after i go to bed. LOCK IT DOWN.

Filesystem does not depend on architecture…i also use ext4 for mmc…yes i know for flash storage there are better filesystems like f2fs,but i’m not familar with it.

Openwrt imho uses squashfs for rw layer on readonly base filesystem.

How you did it?

I want to use regular snapshot, but at the moment is not possibile

Thanks

I use old school ext4 rootfs and rootfs_data,

Boot to nand image, add package cfdisk /dev/mmcblk0 (emmc 8gb). Create partition, there is like 7.1 gb left over from nand to emmc upgrade. I make my root like 4gb . Then Create the leftover space of like 2gb as a rootfs_data. Mkfs.ext4 -L rootfs /dev/mmcblk0p6 , mkfs.ext4 -L /dev/mmcblk0p7. Tar root.image to mounted /dev/mmcblk0p6 not p7 is gonna be your overlay, because you need a couple of packages to get overlay, it takes a couple of different boots, ( I just completely copy the package archive system to /release on p6, saves a boot step. The just change opkg.conf and uhttp config with other share option pointed to release, I also completely undo all of that after I switch back to overlayed p7.

Reset emmc triggered boot switches.

Boot to uboot, not os.

Setenv bootargs root=/dev/mmcblk0p6 rw

Saveenv

Reset

Boot to new p6 root, once os comes up,

fstab in /rom/etc/config is the fstab file to be fix, not the current overlay, because it’s going go puff. Add overlay to fstab, add uuid of p7.

Add packages blockd (required for overlay)

Add packages cfdisk (just for ability to get uid

Add package kmod-nvme( if you have none too)

Once you add block. You can run blockinfo to uuid of overlay(p7) partition. Or you can get it from the original creation of the partition.

You can use openwrt sample to reference fstab. Mine only has 4 entries, two of which have no purpose but reference. /rom,/,/overlay,/srv mount for my 1 tb nvme

after editing /rom/etc/config/fstab

rm -rf /overlay/upper

Reboot.

On this reboot you should see it try to grab p7 as overlay.

It does glitch sometimes. If glitch check /rom again.

If everything goes well df. You should see a p7 p6 mount

Oh yeah disable block service after install, only used to apply system files.

Good luck.

Show quoted text

But problems is that BPI-R3-Mini images use UBI, not directly MMC block

For what, the rootfs, extract it from uograde image. Mount it as loop, tar a to b.

You can use the sysupgrade.itb file from a regular snapshot from downloads.openwrt.org once the partition table is adjusted to the way you want it. Future upgrades will not change that.

But stock has fixed size, and overlay use /dev/fitrw inside an ubi volume

Still missing how to use rest of the space with a pre-compiled version

For my R2 I did something different. Try this.

  1. install Openwrt
  2. resize /dev/mmcblk0p3 to the end of eMMC (e.g. using fdisk)
  3. install Openwrt once again.

My eMMC now is:

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1        640     2687     2048    1M 41 PPC PReP Boot
/dev/mmcblk0p2       8192    90111    81920   40M ea Linux extended boot
/dev/mmcblk0p3      98304 15269887 15171584  7.2G 2e unknown
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 3072      3072         0 100% /rom
tmpfs                  1032688       288   1032400   0% /tmp
/dev/mmcblk0p66        7575520    227264   7348256   3% /overlay
overlayfs:/overlay     7575520    227264   7348256   3% /
tmpfs                      512         0       512   0% /dev