Comment 2 for bug 1718860

Revision history for this message
Steve Langasek (vorlon) wrote : Re: [Bug 1718860] [NEW] Size of system-data partition is not respected when specified

On Fri, Sep 22, 2017 at 07:25:12AM -0000, Alfonso Sanchez-Beato wrote:
> Public bug reported:
>
> When the size of the system data partition is specified in the gadget
> snap, like in:
>
> https://github.com/alfonsosanchezbeato/pc-amd64-gadget-
> cpc/blob/master/gadget.yaml
>
> It turns out that this is really respected: "parted" actually shows the
> right size, but when mounting the partition, "df -h ." reveals that the
> size is much less.
>
> This is because the partition is properly created, but the filesystem
> inside the partition is not filling the partition.
>
> A workaround for this is running these commands on the partition:
>
> # e2fsck -fy <part>
> # resize2fs <part>
>
> But this should not be necessary indeed.

It already shouldn't be necessary because the ubuntu-core initramfs resizes
the root filesystem at first boot. Is this not the behavior you're seeing?

Expanding the filesystem at creation time will decrease the sparseness of
the image. We want to keep the disk images that we ship as small as
possible; the first boot penalty for expanding the filesystem with resize2fs
is small enough that I think this is the right tradeoff (and, we still need
that code anyway because in the non-VM case, the target disk size may be
larger than our image).

So the current behavior is by design, and I don't think we should change it.