How do I create a compressed buildroot system image that expands to fill the available storage of the media it is flashed to?
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Noah,
Quoted 6 lines
Hi! I need to make a Buildroot system for various
x86_64EFI systems with
varying storage sizes, but unfortunately, thepc_x86_64_efi_defconfigconfig creates an IMG file with a fixed partition size, not one that expands to the full size of the media it is flashed to. If I want it to fill the various drives, I need to manually specify the size of each
Quoted 8 lines
drive
in the filesystem config, and then recompile, which is a major pain and ends up making a massive 128GB+ image file. I tried causing it to resize
from within the running system using resize2fs, but that did not work. Ideally, I would like it to either expand to the full size of the drive when it is flashed or to have it resize when it first boots. Is this possible, or is it outside the limits of Buildroot?
You could use parted to increase the partition size, afterwards resize2fs to extend the file system. The partition must not be in use.
The "self-expansion" mechanism observed in some distributions uses a script early during boot.
This is how Raspian handles the resize:
https://salsa.debian.org/raspi-team/image-specs/-/blob/master/rootfs/usr/sbin/rpi-resizerootfs
Before systemd, this used to be wrapped in a link in init.d which was deleted after successful execution; now the logic is contained in the systemd configuration.
Regards,
Andreas