Auto filesystem expansion on boot

Hello there.

I have a question around the auto expansion of the disk image. I know when I flash a Ubuntu Core image on a Raspberry Pi Compute Module 3+, it will then automatically expand the filesystem to the limits of the disk on boot.

Does this also happen when I make a disk image backup, and shrink the partition for faster flashing on another unit? If not, how can I force the system to expand again after flashing the “golden” image? The reason behind this, is we have a image that works, and need to deploy that image with all the stuff set up to other Raspberry Pi Compute Modules, which may have different sizes of storage (16G, 32G). Or should a script do that?

the auto-resize was a feature of Ubuntu Core 16 and 18, in UC20 the system actually creates the data partition at first boot from scratch and does not resize anything anymore …

while resizing after cloning might be possible on the former two, cloning an install is a very bad idea since you will have a lot of first-boot generated data that should be unique to each system, cloning that will give you the same UUIDs, crypto keys, etc on all devices and massively degrade security …

I’m aware of the security implications, I just wanted to know if the OS will resize automatically after “cloning”, but it seems to not the case?

So manual resizing is required, then? (Just be aware, that this CM3+ cloning deployments is isolated, so no public access, only private access)

if you use Ubuntu Core 20, then manual resizing is needed I guess … on UC16/18 it should theoretically work but i do not think this is being tested (so if it regressed nobody will notice) …

I’m not sure how the store will behave if all devices use the same serial which is generated during the “Initialize Device” step during first boot, but it is possible (actually likely) it will refuse to serve updates to the other devices once the first one with that particular serial is seen …

OK, I have quickly tested/flashed an cloned UC16 image (Quite a pita to get it shrunk, exported, etc. used Windows to make a image backup, big mistake)

Anyways, I noticed in the dmesg log that “initrd” logged that there is more than 10% disk space available, so it automatically resized to the full size of the eMMC. (From a 32GB eMMC CM3 to a 16GB eMMC Pi CM3) Happy days.

I’m not worried about the store, as it is isolated from the internet, so it is only operating offline.