Skip to content

Instantly share code, notes, and snippets.

@pedroamador
Forked from bkuberek/gist:5266195
Last active October 4, 2016 13:47
Show Gist options
  • Save pedroamador/fdcd13ab17e35fc7b5d5 to your computer and use it in GitHub Desktop.
Save pedroamador/fdcd13ab17e35fc7b5d5 to your computer and use it in GitHub Desktop.
Vagrant BOX cleaner for Debian / Ubuntu
apt-get -y autoremove
apt-get clean
# 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 /var/lib/dhcp/*
rm /var/lib/dhcp3/*
# Make sure Udev doesn't block our network
echo "cleaning up udev rules"
rm /etc/udev/rules.d/70-persistent-net.rules
mkdir /etc/udev/rules.d/70-persistent-net.rules
rm -rf /dev/.udev/
rm /lib/udev/rules.d/75-persistent-net-generator.rules
# End of cleaning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment