Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • A arch-boxes
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Graph
    • Compare
    • Locked Files
  • Issues 6
    • Issues 6
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Arch LinuxArch Linux
  • arch-boxes
  • Merge requests
  • !17

Write zeros to disk to improve disk compression

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Sven-Hendrik Haase requested to merge github/fork/appleby/improve-disk-compaction into master Aug 02, 2017
  • Overview 5
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: appleby

Write zeros to a file on the root partition until the filesystem is full, then unlink the file. Packer will compress the disk as part of the build, resulting in smaller final disk image.

The same strategy is used in the hashicorp/atlas-packer-vagrant-tutorial repo, here: https://github.com/hashicorp/atlas-packer-vagrant-tutorial/blob/master/scripts/zerodisk.sh

After this change, the virtualbox box file size was reduced by ~230MB on my system:

[ma@march arch-boxes]? du -h Arch-Linux-x86_64-virtualbox-2017-08-02-*
434M    Arch-Linux-x86_64-virtualbox-2017-08-02-after.box
667M    Arch-Linux-x86_64-virtualbox-2017-08-02-before.box

I've only tested this change with the virtualbox-iso provider. I have reason to believe it works with the vmare-iso and qemu providers as well, as I contributed a similar change to the packer-arch repo a while back and they have enabled it for vmware, qemu, and parallels providers. But if it turns out it breaks things for other providers, I can move it into a separate provisioner that has an "only": ["virtualbox-iso"] clause, if necessary.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/appleby/improve-disk-compaction