Question on rootfs size

Hello all,

This one is a bit of a linux noob question, but sometimes we all have 'em.

So, I'm running on a custom imx6 board that has 8 GB of space on its MMC. To initially flash the firmware, I essentially treated the board as a mass storage device and then did the required partitioning and writing with fdisk and dd.

When I do sysupgrades, the rootfs is shrunk back down to whatever I set TARGET_ROOTFS_PARTSIZE to. This makes sense, as I would think there would be some argument whenever it's mounting root telling it the size (although I could not find where it might be).

What I don't get is that if I increase TARGET_ROOTFS_PARTSIZE and make, the size of the produced binary is larger, but not the size of the size of the produced rootfs file.

Here is my device profile if that reveals anything
define Device/mine
  DEVICE_TITLE := manufacturer my-device-name
  SUPPORTED_DEVICES := my-device
  DEVICE_DTS := my-custom-device-tree
  BOOT_SCRIPT := ha-i-dont-even-use-but-i-copy-pastad-and-didnt-remove-yet
  UBOOT := unused
  KERNEL := kernel-bin | append-uImage-fakehdr filesystem
  KERNEL_IMG := kernel.img 
  FILESYSTEMS := ext4
  IMAGES := sysupgrade.bin also-my-custom-dtb.dtb
  IMAGE/also-my-custom-dtb.dtb := install-dtb
  IMAGE/combined.bin := append-rootfs | pad-extra 128k | imx6-sdcard
  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef

Lastly, is there some way I could programmatically change the size of rootfs on first boot after upgrade?

I know that this could be done by booting into another partition and then modifying, but I was hoping for something a bit cleaner than that.

Thanks for any insight!

you can do this via lib/upgrade/ABC.sh ( or theoretically lib/preinit )... imho... it's not practicable for most users... and you should use ROOTFS_PARTSIZE...

empty space withing a roofs file is likely padded zero's which compress to virtually identical sizes...

is that not the intention? if you do not use the -p switch... recent upgrade logic will retain your previous partition sizes...

Yeah, it is the intention I suppose. I guess my head is just stuck in the idea that if the partition it's on is 6.8 GB that the rootfs should try to use that space. I still have much to learn about linux and really just filesystems.

Also I have to do upgrades though luci for now, meaning I don't directly pass it flags like that. But thanks, I'll have another look at where luci does the upgrade.

Thanks. For some reason I guess I didn't really think to look outside of what i modified to add upgrade support for my board in the first place (/lib/upgrade/platform.sh and /lib/imx6.sh)

Thanks again!