Don't build 4GB images, build images as big as the required contents. #63

Merged
merged 1 commit into from Sep 15, 2016

Conversation

Projects
None yet
3 participants
Contributor

vorlonofportland commented Sep 14, 2016

snappy supports auto resizing of the root partition on first boot, so we
don't need to preallocate space. This makes it faster to write the image to
a disk (we already use sparseness everywhere else to ensure fast writes),
and avoids problems with media that is slightly below the nominal size.

This change:

  • fixes _calculate_dirsize() to always return an integer (rounding up)
  • adds explicit padding for ext4 metadata (so we never try to use a size
    of 0 for our partition when we have no initial files to create)
  • fine-tunes the requirements for the backup GPT space, which previously
    worked more or less by accident
  • does not require the rootfs to be an even multiple of 1MiB, since aligned
    reads don't matter nearly so much at the end of the disk and we'll be
    resized to use whatever space is available anyway so it's short-lived.
Don't build 4GB images, build images as big as the required contents.
snappy supports auto resizing of the root partition on first boot, so we
don't need to preallocate space.  This makes it faster to write the image to
a disk (we already use sparseness everywhere else to ensure fast writes),
and avoids problems with media that is slightly below the nominal size.

This change:

 - fixes _calculate_dirsize() to always return an integer (rounding up)
 - adds explicit padding for ext4 metadata (so we never try to use a size
   of 0 for our partition when we have no initial files to create)
 - fine-tunes the requirements for the backup GPT space, which previously
   worked more or less by accident
 - does not require the rootfs to be an even multiple of 1MiB, since aligned
   reads don't matter nearly so much at the end of the disk and we'll be
   resized to use whatever space is available anyway so it's short-lived.

@vorlonofportland vorlonofportland merged commit 1954fc6 into master Sep 15, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
Collaborator

mvo5 commented Sep 15, 2016

One thing to consider here is that this makes it harder to use the image directly inside qemu/kvm or experimenting/development. Unless I miss something there will be (almost?) no free space so that the first snap install will result in a out-of-diskspace error.

ogra1 commented Sep 15, 2016

http://paste.ubuntu.com/23181304/ has a quick-hack workaround ... though long term we probably want an actual --size or --minsize option

ogra1 commented Sep 15, 2016

hmm, or not ... seems this iis the wrong place to inject the size

ogra1 commented Sep 15, 2016

equally ugly, but now working :) http://paste.ubuntu.com/23181669/

@warsaw warsaw deleted the lp.1619362 branch Sep 19, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment