Monday, August 24, 2015

Recovering Lost VMs in VirtualBox GUI

This article is a short step on how to recover you VMs in the VirtualBox GUI.

Case

I upgraded my windows machine from windows 8 to 10 and suddenly stumbled on an empty virtualbox GUI. It was almost heart wrenching for me because, I had six vm as lab. I did as much googling as I could but did not get a suitable answer. So I resulted to reading up the Virtual Machine Guide.
While this exercise was carried out on version 5.0, it works well for VirtualBox 4.0 and later.

VirtualBox GUI without existing vms entries.



Existing vm files on disk


Conditions

This process will work

  • if our virtual machine guest folder has not been corrupted and still intact.
  • regardless if you had to do a new installation all over again. Just ensure the version you are installing is the same as the one your previously lost.
  • whether or not you lost your VirtualBox.xml file in the \.VirtualBox location.



Recovery Steps

Open the VirtualBox.xml in an text editor (I use Textpad). Search for the tag . Two things are possible - 
  1. The tag has content as in but the source ("src") attribute of the entry tag is pointing to the wrong location of the VM.
  2. The tag is a closed tag as in or which means that VirtualBox has lost a reference to all the VMs on the host.


Case 1

Simply edit the value of the "src" attribute to point to the correct location of the guest .vbox file.
the vbox file of the guest machine


Case 2

If the close machine registry tag is of the form , change it to the open form and enter the following entry

where
MACHINE_ID - this should be gotten from the vbox file of the guest. Open the .vbox file in a text editor and look for the uuid of the tag.
the uuid of the guest machine

The entry highlighted above is the uuid for this machine and should be the same with the uuid of the machine registry in the VirtualBox.xml.

Which ever case you use, save the file and reopen VirtualBox.

No comments: