Skip to content
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

Reduce size of GCE bootstrap images #590

Closed
3noch opened this issue Jan 24, 2017 · 8 comments
Closed

Reduce size of GCE bootstrap images #590

3noch opened this issue Jan 24, 2017 · 8 comments
Assignees

Comments

@3noch
Copy link

3noch commented Jan 24, 2017

The GCE bootstrap images are 100GB and you cannot create an instance with a root disk smaller than the bootstrap image. This means that creating a GCE instance with an SSD is at least $12/month more than using a standard disk. In most cases you do not need instances with 100GB of disk space (or you'd offload that to a single database server).

How hard would it be to build a new image that's smaller and make that the default?

@rbvermaa
Copy link
Member

Should be easy, just need to test if somehow we can allow growing the partition if needed/specified.

@rbvermaa rbvermaa self-assigned this Jan 30, 2017
@clefru
Copy link
Contributor

clefru commented Mar 23, 2017

I have built a 1GB image that includes partition growing. Please test with::

  resources.gceImages.bootstrap = credentials // {
    sourceUri = "gs://nixos-images-clefru/nixos-image-17.03.git.f119e1d-x86_64-linux.raw.tar.gz";
  };

  fooinstance = {
    deployment.gce = credentials // {
       rootDiskSize = 30;
    };
  };

clefru/nixpkgs@3d43324 is the commit. I built this from https://github.com/clefru/nixpkgs/tree/gce-image-shrink which is channels/nixos-17.03 from about yesterday, plus the NixOS/nixpkgs#24143 cherry-picked. The cherry-picking is necessary otherwise the kernel used during the QEMU build phase will corrupt data when talking to /nix/store via 9p. You suffer from this bug if your "cp" command complains about hard-links in /nix/store.

Don't depend on my image to hard (or make a copy), as I will eventually remove it after 17.03 is out and has its own official images.

@3noch
Copy link
Author

3noch commented Mar 23, 2017

@clefru Wow this is awesome! Great work!

@domenkozar
Copy link
Member

See NixOS/nixpkgs#24360

@clefru
Copy link
Contributor

clefru commented Mar 27, 2017

My original image only resized the partition, not the filesystem within. The following image should work better:

  resources.gceImages.bootstrap = credentials // {
    sourceUri = "gs://nixos-images-clefru/nixos-image-17.03.git.d0e4b3f-x86_64-linux.raw.tar.gz";
  };

@Mic92
Copy link
Member

Mic92 commented Apr 24, 2017

was fixed by NixOS/nixpkgs#24360 and can be closed

@domenkozar
Copy link
Member

We should first update images?

@domenkozar
Copy link
Member

Fixed in c28a4f7

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

No branches or pull requests

5 participants