VM - Part Five: Cleanup and Troubleshooting

VM - Part Five: Cleanup and Troubleshooting

default avatar
Thought byTess Flynn
January 09, 2015
FFW Blog - illustration

Cleaning up is one of the advantages of working with VMs over a bare metal install. Since everything is in the disk image files, we only need to delete the VM. Vagrant provides two commands for this purpose:

Stopping and Deleting the VM

Change to the directory containing the Vagrantfile, and then stop the VM:

vagrant halt

To delete the VM permanently:

vagrant destroy

That’s it!

Cleaning up the Hosts File

You may choose to remove any custom hostnames you created in your hosts file on your host OS. If you’re using VDD across multiple projects, however, there’s no need to delete the drupal7.dev and drupal8.dev host file entries. Even if you decide to clone VDD again in a different directory, it will still use the same IP address and hostnames.

Troubleshooting

Troubleshooting a vagrant VM can be difficult. The most common problems are bad provisions due to interruption, corrupted download, or misconfiguration.

  1. Ensure your connection is fast and stable.
  2. Reload the VM using vagrant reload.
  3. If the VM still does not provision correctly, vagrant destroy it and try again.
  4. If you used vagrant box to import the VM (as instructed on http://vagrantbox.es), you need to delete the base VM from your system using vagrant box remove.
  5. Don’t be afraid to start over. Sometimes it’s faster to build a new VM than troubleshooting what went wrong.

Summary

This was a short post, but we’ve covered so much throughout this series! I hope that you’ll find using Vagrant and VMs can be a huge boost to your development workflow, especially when switching clients