From f445ebb0285dd30c01449691328e7c11194be0b7 Mon Sep 17 00:00:00 2001 From: Mike Appleby Date: Wed, 2 Aug 2017 11:24:50 -0500 Subject: 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. --- provision/cleanup.sh | 6 ++++++ 1 file changed, 6 insertions(+) mode change 100644 => 100755 provision/cleanup.sh (limited to 'provision') diff --git a/provision/cleanup.sh b/provision/cleanup.sh old mode 100644 new mode 100755 index b8a2336..29da429 --- 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 -- cgit v1.2.3-70-g09d2