Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Feature] - Smaller snapshot size #107

Closed
filipetoscano opened this issue Feb 16, 2021 · 3 comments
Closed

[Feature] - Smaller snapshot size #107

filipetoscano opened this issue Feb 16, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@filipetoscano
Copy link

Is your feature request related to a problem? Please describe.
Taking a snapshot of an instance with a 25 GB disk yields a 25 GB snapshot even if only a fraction of the disk is being used -- which results in:

  • High time to take a snapshot (not major, since new base images aren't created all the time);
  • Takes time to spin new instances (annoying, since the purpose of using packer+terraform was to speed up node spin-up)

Describe the solution you'd like
That packer-builder-vultr would yield smaller snapshot images.

Describe alternatives you've considered
Not using packer: moving our shell scripts to provisioning stage after instance spin up.

@filipetoscano filipetoscano added the enhancement New feature or request label Feb 16, 2021
@filipetoscano filipetoscano changed the title [Feature] - Smaller [Feature] - Smaller snapshot size Feb 16, 2021
@ddymko
Copy link
Contributor

ddymko commented Feb 16, 2021

@filipetoscano

This is something that could be addressed by zeroing out the unused space on the volume with a shell provisioner in your packer setup
https://www.packer.io/docs/provisioners/shell

@filipetoscano
Copy link
Author

Hi @ddymko !

The remark on snapshot is with regards to a newly spun up instance (by packer) -- how could the virtual disk grow to the full 25 GB by running a handful of scripts?

Do you have any automated recipe for zeroing out unused space?

In order to use zerofree, you need to reboot into a read-only /dev/vda1 -- at least I couldn't do a live remount, not even after stopping services/killing processes which were actively writing to the partition.

@ddymko
Copy link
Contributor

ddymko commented Feb 16, 2021

You could have a shell provisioner run something such as

 "dd if=/dev/zero of=/EMPTY bs=1M | true",
 "rm -f /EMPTY",
 "sync"

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants