Skip to content

Instantly share code, notes, and snippets.

@rubenmromero
Forked from pedroamador/VagrantBOXCleanerCentos
Last active August 27, 2018 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubenmromero/43d7674a338ce426eadfc8fa757f79f0 to your computer and use it in GitHub Desktop.
Save rubenmromero/43d7674a338ce426eadfc8fa757f79f0 to your computer and use it in GitHub Desktop.
Bash :: Vagrant Box Cleaner for CentOS / Red Hat
# Clear yum packages
yum clean all
# Zero out the free space to save space in the final image:
dd if=/dev/zero of=/EMPTY bs=1M
rm -f /EMPTY
# Removing leftover leases and persistent rules
echo "cleaning up dhcp leases"
rm -f /var/lib/dhclient/*
# Make sure Udev doesn't block our network
echo "cleaning up udev rules"
rm -rf /etc/udev/rules.d/70-persistent-net.rules
mkdir /etc/udev/rules.d/70-persistent-net.rules
rm -rf /dev/.udev/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment