Restoring an accidentally deleted Vagrant directory

If you accidentally deleted your Vagrant directory, and you have an orphaned VM sitting in VirtualBox, you can re-associate it with a new VagrantFile. Here's how.

When new VM is first created for a given VagrantFile, Vagrant creates a .vagrant file in the same directory. It contains a JSON array, which stores the Unique ID:


You need to re-create this file.

1) Determine the Unique ID for the VM.

To see a list of all Virtual Box vms:

$ VBoxManage list vms

2) Re-create the .vagrant file by adding the appropriate UUID to JSON a array in .vagrant.
3) Recreate the VagrantFile.

Thank you! This saved my day.

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.