Adjusting resin-root partition size

Hi,

I’d like to tweak the size of the resin-root(A and B) partitions on a raspberrypi4-64 build (technically it’s for a CM4). Anyone know where in the yocto files those sizes (currently at 300MB) are being set?

Thanks,

Andrew

Hi Andrew,

In a device type repository with submodules cloned, the recipe you’re looking for is layers/meta-balena/meta-balena-common/recipes-core/images/balena-image.bb, and the variable is IMAGE_ROOTFS_MAXSIZE, which defaults currently to 319488. Let me know if this helps.

Thanks @jakogut, that works to increase the partition size. I had initially tried an alternative approach by modifying the image_types_balena.bbclass, your suggestion looks better.

├─mmcblk0p2 179:2 0 364M 0 part
├─mmcblk0p3 179:3 0 364M 0 part

So now that the partition is larger, I see that

/dev/mmcblk0p2 300M 296M 0 100% /mnt/sysroot/active
overlay 300M 296M 0 100% /

Which is identical to what it was previously. Any idea how to increase that overlay/mount?

Thanks.

Quick update, I can grow the partition using resize2fs:

resize2fs /dev/mmcblk0p2

That gives me the correct file size

root@:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk0p2 351M 296M 34M 90% /mnt/sysroot/active

But this is a clean install, why is the resize2fs necessary?

Thanks,

Andrew

Hey @smithandrewc, can you confirm your settings used for these variables in balena-image.bb and which result was unexpected?

IMAGE_ROOTFS_SIZE = "319488"
IMAGE_OVERHEAD_FACTOR = "1.0"
IMAGE_ROOTFS_EXTRA_SPACE = "0"
IMAGE_ROOTFS_MAXSIZE = "${IMAGE_ROOTFS_SIZE}"

It sounds like the resulting partition was the desired size, but the filesystem was not extended to fill the new partition size. Is that correct?

Thanks @klutchell. Almost the same, I was increasing IMAGE_ROOTFS_SIZE

IMAGE_ROOTFS_SIZE = "372736"
IMAGE_OVERHEAD_FACTOR = "1.0"
IMAGE_ROOTFS_EXTRA_SPACE = "0"
IMAGE_ROOTFS_MAXSIZE = "${IMAGE_ROOTFS_SIZE}"

Initially I had set IMAGE_ROOTFS_SIZE = "370688" but when I tried to compile it, it gave me an error message about exceeding rootfs maxsize, so I set IMAGE_ROOTFS_SIZE to the value it gave.

As you commented, it looks like the partition is ok but the filesystem is staying at ~300M. I’ve been trying to find if it’s hard-coded somewhere.

Thanks for the help.

What if you try with the following values to ensure there is empty space added to the rootfs? This worked for a quick local test on my Raspberry Pi 4.

IMAGE_ROOTFS_SIZE = "319488" 
IMAGE_OVERHEAD_FACTOR = "1.0"
IMAGE_ROOTFS_EXTRA_SPACE = "53248"
IMAGE_ROOTFS_MAXSIZE = "372736"

Thanks @klutchell, that has addressed the issue.