Page 1 of 1

Re-use VMs with a new VirtualBox installation

PostPosted: 22. Jan 2009, 01:38
by vb101
I'm using Acronis TI to backup my C: drive. Couple of weeks ago I've installed VirtualBox 2.1 and made two guest VMs (W7B1 and WinXP-SP3) kept on my data drive D:. Two days ago I've restored image of my C: drive that was made before installation of VirtualBox. I installed VirtualBox 2.1 again and now I do not see a way how to use my saved VMs.

Is it possible to re-use images of VM's again?

I have two folders on D: containing:
for Windows 7 Beta 1:

and for WXPSP3:

PostPosted: 22. Jan 2009, 19:15
by TerryE
Yes it is (by way of a hack), but this is not directly supported. You need to ensure that the VMs registry <machine>.XML and the VirtualBox.xml registery both correctly reference the files. If you've backed this up then look at the old backup to work out how.

PostPosted: 23. Jan 2009, 01:11
by vb101
TerryE - thank you for the reply. Unfortunately, it was emergency recovery for drive C: (where VirtualBox.xml file is located) and I have not made a backup of that file. With this regard - is there any way to change position of VirtualBox.xml from its default place (%USERPROFILE%\.VirtualBox\VirtualBox.xml) to any other place in drive D? It'd certainly help in such cases...

I have VMWare Workstation installed on the same computer. And all I had to do was to open old .vmx file(s) and that was it. I may run that virtual machine again. Why it so difficult to do with VirtualBox?

Is it because "VirtualBox.xml" file contains uuid's of all VM hard disks, DVD images, etc? Then it's obviously not the right way to do configuration. All virtual machine related info must be placed in corresponding "aVirtulMachine.xml" file. Then all you have to do to restore VM is to open that file... Current "VirtualBox.xml" file should contain only references to those "aVirtulMachine.xml" files.

PostPosted: 23. Jan 2009, 06:24
by TerryE
AFAIR, the UUIDs that you need are in the machine.xml. I've done a couple of posts on this before so if you google this site for some of the VBox XML tags, then you'll probably find them.

One what to work out what you need is to set up a dummy machine with a livecd ISO and a couple of VDI and snapshot it then you will see what tags are needed. (Powered on in one case to represent the XP config and powered off for the Vista one). BTW, if you want to keep snapshots for more than immediate rollback, its a good idea to power off the VM then do the snapshot. This saves the intermediate SAV files and all of their complexities.

PostPosted: 23. Jan 2009, 07:33
by vb101
TerryE, thanks again for trying to help me. I've got it to that sate that I can see both VM's in main VirtualBox window (accepted as common VM's made by it). It's a really complicated way... In short what I did is:

1). Modify %USERPROFILE%\.VirtualBox\VirtualBox.xml:
Code: Select all   Expand viewCollapse view
--- replace with:
      <MachineEntry uuid="{776eacc7-0fa0-49e9-aaec-37b67d9d1965}" src="D:\VM\VB\W7B1\W7B1.xml"/>
      <MachineEntry uuid="{75da2984-4b2d-4380-8944-5cfc81620b22}" src="D:\VM\VB\WXP-SP3\WXP-SP3.xml"/>

where: "{75da2984-4b2d-4380-8944-5cfc81620b22}" is taken from "D:\VM\VB\WXP-SP3\WXP-SP3.xml" ( <Machine uuid="{75da2984-4b2d-4380-8944-5cfc81620b22}" ...).

2). Go to "File | Virtual Media Manager | CD/DVD Image" and add new image pointing to an ISO file. Click OK. Exit VirtualBox.

3). Open %USERPROFILE%\.VirtualBox\VirtualBox.xml file and note new uuid associated with added ISO file.
Code: Select all   Expand viewCollapse view
        <Image uuid="{0bf774e9-b973-4b7a-9d48-2a1cccbd196a}" location="D:\Storage\m$\en_windows_xp_professional_with_service_pack_3_x86_cd_vl_x14-73974.iso"/>
        <Image uuid="{13ac756a-7667-4d3b-b2a1-43119480e8ca}" location="\\\archive\Soft\m$\OS\W7B1\W7B1_256MB.ISO"/>

4). Edit "D:\VM\VB\WXP-SP3\WXP-SP3.xml" replacing:
Code: Select all   Expand viewCollapse view
      <DVDDrive passthrough="false">
        <Image uuid="{a485ea0a-ad7e-4214-b448-864a4a5460f9}"/>  <-- old value
--- replace with:
      <DVDDrive passthrough="false">
        <Image uuid="{0bf774e9-b973-4b7a-9d48-2a1cccbd196a}"/>  <-- new value

5). Add hard disk(s) in "VirtualBox File | Mirtual Media Manager | Hard Disks" and Add new one pointing to root VDI files.

6). If there are snapshots (like with W7B1) - edit %USERPROFILE%\.VirtualBox\VirtualBox.xml:
Code: Select all   Expand viewCollapse view
        <HardDisk uuid="{e3e4629e-77ef-4945-b2fb-8e309c5d697c}" location="D:\VM\VB\W7B1\W7B1.vdi" format="VDI" type="Normal">
          <HardDisk uuid="{47f19991-2d74-4b6c-b249-143f6f99cded}" location="D:\VM\VB\W7B1\Snapshots\{47f19991-2d74-4b6c-b249-143f6f99cded}.vdi" format="VDI"/>
        <HardDisk uuid="{dfb22f7f-121b-4bbc-8893-ce496ea6c2c5}" location="D:\VM\VB\WXP-SP3\WXP-SP3.vdi" format="VDI" type="Normal"/>

Note: snapshot hard disk file is within main hard disk and it doesn't have "type" attribute.
Note2: snapshot hard disk in W7B1.xml file has associations:
Code: Select all   Expand viewCollapse view
    <Snapshot uuid="{af986cbf-9c83-440d-91dc-617d7d9d30e5}" name="Just installed" timeStamp="2009-01-16T07:22:51Z" stateFile="Snapshots\{af986cbf-9c83-440d-91dc-617d7d9d30e5}.sav">
        <HardDiskAttachment hardDisk="{e3e4629e-77ef-4945-b2fb-8e309c5d697c}" bus="IDE" channel="0" device="0"/>
      <HardDiskAttachment hardDisk="{47f19991-2d74-4b6c-b249-143f6f99cded}" bus="IDE" channel="0" device="0"/>

Note3: Snapshot folder contains 3 files:
Code: Select all   Expand viewCollapse view
{af986cbf-9c83-440d-91dc-617d7d9d30e5}.sav   - made earlier (at snapshot time) - ref. as snapshot HD
{776eacc7-0fa0-49e9-aaec-37b67d9d1965}.sav   - made later, it's uuid of machine
{47f19991-2d74-4b6c-b249-143f6f99cded}.vdi   - made later, it's current HD of machine

main folder contains:
Code: Select all   Expand viewCollapse view
W7B1.vdi  - associated with uuid="{e3e4629e-77ef-4945-b2fb-8e309c5d697c}" (snapshot HD, not machine HD)

Now I can see both VM's in VB. WXP-SP3 has editable properties (right side of VB has Genera, Hard Disks, etc. as links) and W7B1 has undeniable properties (all those links items are just a names, not links). And so far I do not know why.

I've made copy of WXP-SP3 by copying its .vdi file, changing its uuid (using "VBoxManage.exe internalcommands setvdiuuid D:\Path\aFile.vdi" command). Both WXP-SP3 and WXP-SP3_2 were started successfully (I'm not so confident with W7B1 machine - so far I've not attempted to run it yet). I'm starting experiencing problems with VB v2.1.2 crashing on WXP-SP3_2 guest machine more often than I have seen it with old version v2.1.0. I think it's a separate case and is not related to what we're discussing here. So, I've posted it in another thread on this forum (

Looking at the complexity of the way to fix the problem - I think that if 'aVirtualMachine.xml' file contained all setting related to that VM in one place (instead of spreading uuid's among all virtual machines and one "VortualBox.xml" file as it's done now) it would make this job easier. But frankly I expect that this process should be done automatically by VB itself... It's a common case (re-using VM, copy VM to another place, backup VM, etc.) and it should be easier for users like me. don't you think?

PostPosted: 23. Jan 2009, 16:55
by TerryE
This reminds me a little of the early days of databases where a crash could result in the integrity of your tables being screwed and there were no repair utilities. The reality is that these files include referential data that must be consistent for VBox to start. There are valid user scenarios where these can be or become inconsistent. This has happened to me. OK, if you are sufficiently conversant with the data model implemented in these files, and with XML syntax, then you can go in an manually patch this up as you and I have both done. However, this is not a job for the average user.

We could really do with a little repair utility to sort this sort of issue out.

Re: Re-use VMs with a new VirtualBox installation

PostPosted: 5. Mar 2010, 12:23
by tnvbox
I FOUND THE SOLUTION and it's simple. Install VBoxGtk (I'm using 0.5.0). Click on the hard drive icon. A new popup appears that says "Manage Media" and gives the option of adding/registering/unregistering/deleting either a Hard Disk or a CD/DVD Image. Add a new hard disk, and browse over to the .vdi file from your old client install. Now, close VBoxGtk. Open VirtualBox OSE and select "new" and start configuring a new guest operating system. After asking for memory allocation, etc, it will ask for the Primary Master HD for your new VM, and choose "existing hard disk". After adding the .vdi file from the first step I outlined above, your old guest OS should be listed. Choose it and you're done! No need to edit any XML files, at least when you do it this way, with the Gtk and OSE gui's.

Re: Re-use VMs with a new VirtualBox installation

PostPosted: 7. Mar 2010, 11:15
by mpack
tnvbox wrote:I FOUND THE SOLUTION and it's simple. Install VBoxGtk

Note the name of this forum, particularly the "Windows Hosts" part.

In fact the procedure you describe can be done with the standard VBox GUI, however the procedure itself isn't very useful when snapshots have been used, as in the OPs case.