From 6447b9a5b2607be32a7de731ca4f482a2df43cdd Mon Sep 17 00:00:00 2001 From: mikepell Date: Thu, 30 Jun 2022 13:43:11 +0000 Subject: [PATCH] add drive compact/zero --- prepare-ubuntu-18.04-template.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/prepare-ubuntu-18.04-template.sh b/prepare-ubuntu-18.04-template.sh index f66b3b9..9bedd10 100755 --- a/prepare-ubuntu-18.04-template.sh +++ b/prepare-ubuntu-18.04-template.sh @@ -98,6 +98,11 @@ sudo sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab # cleans out all of the cloud-init cache / logs - this is mainly cleaning out networking info sudo cloud-init clean --logs +echo "Compacting drive..." +dd if=/dev/zero of=EMPTY bs=1M > /dev/null +rm -vf /root/EMPTY +fstrim -av + #cleanup shell history cat /dev/null > ~/.bash_history && history -c history -w