Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Appleby <mike@app.leby.org>2017-08-02 11:24:50 -0500
committerMike Appleby <mike@app.leby.org>2017-08-02 11:24:50 -0500
commitf445ebb0285dd30c01449691328e7c11194be0b7 (patch)
tree61ccd56d5b16926222269e29a682074d93c7d199
parentf9206846329cc1f6b89f510698267e5dec1ef2ca (diff)
Write zeros to disk to improve disk compression
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.
-rwxr-xr-x[-rw-r--r--]provision/cleanup.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/provision/cleanup.sh b/provision/cleanup.sh
index b8a2336..29da429 100644..100755
--- a/provision/cleanup.sh
+++ b/provision/cleanup.sh
@@ -4,3 +4,9 @@ set -e
set -x
yes | sudo pacman -Scc
+
+# Write zeros to improve virtual disk compaction.
+zerofile=$(/usr/bin/mktemp /zerofile.XXXXX)
+dd if=/dev/zero of="$zerofile" bs=1M || true
+rm -f "$zerofile"
+sync