-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto resize partition #5
Comments
Hi. Thanks for the report. I've always found this option confusing, particularly when used with implicitly generated file rules (as in your example and the in-tree layouts). I can reproduce what you see and I can workaround it, but the workaround doesn't yield a resized partition (so obviously it's not really a workaround!). All it does is seemingly make genimage ignore the
I believe this is a genimage thing. The documentation says this:
Your example (and the in-tree layouts) refer to an image file (e.g. root.ext4) which is specified as a separate image section. That image section specifies the size (which is the size of the raw partition image that is created). Once that partition image is created, it cannot be resized because there is no other size which governs the overall hdimage size (ie the hdimage size is governed by the sizes of the raw partition images generated). Even if I try this, I see the same error:
...which is confusing because I think that looks a lot like https://github.com/pengutronix/genimage/blob/master/test.config#L84 which I assume works. Maybe it only works because UBI has it's own actual autoresize feature which resizes the volume on first use. I'm not really sure how to make |
@learmj Thanks for your input! as long as the autoresize feature does not work, what about a workaround by resizing during first boot by adding a bash script? |
I feel that the on-device (one-time) resize is something we should try and move away from now. It exists largely because it's inefficient to write huge images into the device using primitive tools, which takes too too long. rpi-image-gen generates sparse images which are compatible with fastboot meaning you can have a raw disk image with largely empty, low disk-usage but high 'apparent size' filesystems that squash down significantly when sparsed, then you can write these to the device very quickly when it's running pi-gen's fastboot gadget. While you have to be careful copying around sparse images, if they're compressed using a sparse-aware compression tool (eg like zstd) their compressed versions can be copied around easily enough and decompressed to retain their 'sparseness'. Similarly, I've used tools like bmaptool to write huge, largely empty filesystem images to the device when it's running pi-gen's mass-storage gadget. bmaptool works in a similar way to sparse in that it generates a map of 'holes' in the image. Performance of bmaptool was comparable to fastboot, although fastboot seemed to have the edge in my rudimentary tests. I don't plan on adding a volume resize script as it detracts from the direction that I believe we want to go in for provisioning of images. rpi-sb-provisioner exposes block device level control to a fastboot client, so it should be capable of flashing individual partitions with sparsed partition images. At the moment, the rpi-image-gen in-tree layouts only generate a sparse image of the entire disk image, but I am considering generating sparse partition images, too. If rpi-sb-provisioner creates partitions inside LUKS of sufficient size, I'm of the view that fastboot can be used to write them straight in. paging @tdewey-rpi Cheers, |
a complex area. I just had a look at bmaptool to understand what your comments about holes is about. What I would like to create is this Image and Partition layout structure. Please find my basic genimage.cfg.in underneath [*]. What would be the recommendation to create an example layout like this to keep the image as small as possible for flashing:
Next action I plan to do is to play around with rpi-sb-provisioner to load this image and partition structure with fastboot into the SD card without LUKS encryption and afterwards with LUKS to lock ROOT, USERDATA, LOGDATA. [*] genimage.cfg.in
|
Setting Create the map:
Use the map to write the image:
Either fastboot or bmaptool will write the image to storage significantly quicker than dd or rpi-imager would. |
As an example, I created a 16G image just by adjusting the sizes in https://github.com/raspberrypi/rpi-image-gen/blob/master/image/mbr/simple_dual/genimage.cfg.in, and while the filled sizes and filesystem layout is not the same as your case, my 16GB image sparsed down to 410MB:
The bmaptool map is tiny and generated in next to zero time. Comparison time Pi5 to Pi5 to write the image to a 32G SD card: fastboot (pi-gen micro fastboot gadget):
bmaptool (pi-gen micro mass-storage gadget):
|
I would like to "auto resize" my root and logs partition
however "autoresize=true" doesn't work:
This error is thrown:
.ERROR: hdimage(/home/pi/pi-workspace/rpi-image-gen/work/xyz/artefacts/IPGW2-LITE.img): the image size must be specified when using an 'autoresize' partition
The text was updated successfully, but these errors were encountered: