<p dir="ltr">It doesn't make much sense to have an option that controls the generated disk image size by itself. We have multiple volumes, multiple images, and multiple partitions inside any given volume. What is the size referring to? To make sense of it, ubuntu-image must necessarily learn more about what to do with that value via the gadget.yaml itself.</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Oct 12, 2016 1:50 PM, "Barry Warsaw" <<a href="mailto:barry@ubuntu.com">barry@ubuntu.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">On Oct 11, 2016, at 10:54 AM, Steve Langasek wrote:<br>
<br>
</div><div class="quoted-text">> - a --size option to ubuntu-image to specify the full image size (needs<br>
> some careful thought for the multiple-image case)<br>
> - keep the 50% buffer on ext4 filesystem size as a floor (the '50%' can be<br>
> refined over time with investigation into the actual size requirements<br>
> for ext4 metadata, but this is not a high priority; highest priority is<br>
> that it works reliably)<br>
> - if --size is smaller than the minimum size needed to accommodate the<br>
> contents, warn but build the image anyway - because all the expensive<br>
> work of ubuntu-image happens /before/ we're able to calculate the final<br>
> size, so throwing that all away at the end would be /very annoying/.<br>
<br>
</div>I want to clarify something here which (if I'm right ;) helped me reach a<br>
decision on this.<br>
<br>
The "size" that Ogra wants to control is the generated disk image file size,<br>
not the size of any particular partition within that disk image. IOW, it's<br>
the size of the file that gets written to from the --output/-o option of u-i.<br>
<br>
There is nothing in the gadget.yaml that describes this value. It's entirely<br>
calculated by u-i. More specifically, there is no 'size' option in the<br>
<volume name> section.<br>
<br>
If this is correct, then it's obvious (for now, without changes to the<br>
gadget.yaml spec) that only a command line option will work.<br>
<br>
I propose to add an option called --image-size (no shortcut) that takes a size<br>
parameter in bytes, with allowable suffixes 'M' for MiB and 'G' for GiB'.<br>
Since u-i currently only supports a single volume gadget.yaml, an unindexed<br>
size will apply to the one and only volume. In the future, when we support<br>
multiple volumes (i.e. disk images), we can extend the syntax. See LP:<br>
#1632085 for details.<br>
<br>
Further, if --image-size is less than the calculated size, I propose that we<br>
warn loudly and ignore --image-size. That way, we don't throw away all the<br>
work we have to do before we can calculate the image size, but we also don't<br>
generate a corrupted image.<br>
<br>
Let me know if this will work for you and/or feel free to comment on the above<br>
mentioned bug.<br>
<br>
Cheers,<br>
-Barry<br>
<br>--<br>
Devices mailing list<br>
<a href="mailto:Devices@lists.snapcraft.io">Devices@lists.snapcraft.io</a><br>
Modify settings or unsubscribe at: <a href="https://lists.snapcraft.io/mailman/listinfo/devices" rel="noreferrer" target="_blank">https://lists.snapcraft.io/<wbr>mailman/listinfo/devices</a><br>
<br></blockquote></div><br></div>