To totally unlock this section you need to Log-in
Login
If you’re running VirtualBox on a Windows computer, you’ll probably run into errors from time to time: especially duplicating VMs (and their virtual disks).
Apparently, when VirtualBox creates a .vdi (or another format virtual hard drive), it bakes in a universally unique identifier that it uses to recognize VDIs. Usually it doesn’t cause problems, but in this case, it prevents duplicates or moved virtual disks from running from an unknown location.
The error looks like this:
In details you will see something like the following:
“Failed to open the hard disk E:\VirtualBox VMs\Windows 8 \Windows 8 Enterprise2.vhd. Cannot register the hard disk ‘E:\VirtualBox VMs\Windows 8 \Windows 8 Enterprise2.vhd’ {ca2bdc6a-a487-4e57-9fcd-509d0c31d86d} because a hard disk ‘E:\VirtualBox VMs\Windows 8 Enterprise\Windows 8 Enterprise2.vhd’ with UUID {ca2bdc6a-a487-4e57-9fcd-509d0c31d86d} already exists. Result Code: E_INVALIDARG (0x80070057) Component: VirtualBox Interface: IVirtualBox {3b2f08eb-b810-4715-bee0-bb06b9880ad2} Callee RC: VBOX_E_OBJECT_NOT_FOUND (0x80BB0001)”
The following error screen could also appear, regarding a general VM Config error but explaining that a VM has the same UUID of another.
Reset the UUID
To fix this, you’ll need to run some text commands. Open up the Command Prompt (cmd.exe). In both Windows 8/8.1/10 and Windows 7, it can be found by typing “cmd” into the Start Menu search box.
Now change the cmd prompt’s directory to the folder you installed VirtualBox in. If you put it in the default the command is this:
cd C:\Program Files\Oracle\VirtualBox\
You need to run the following command in the command prompt opened, in VirtualBox folder, with three main parameters:
- internalcommands
- sethduuid
- The full path of the .vdi or .vmdk virtual disk file, for example: C:\Users\user\VirtualBox VMs\LinuxVM – OBIEE12c\LinuxVM.vmdk.
Now type in the following command (or copy/paste using right click):
vboxmanage.exe internalcommands sethduuid “pathtovhdfile”
Whilst this command changes the UUID of the .vdi or .vmdk hard disk file it doesn’t actually change the UUID of the machine. However you still need a new UUID for the machine. The way to do this is to run the VBoxManage command twice (a second time, with same parameters). The UUID from the second run will be used by the hard disk leaving the first one available for the machine.
If everything worked, you should see a message saying "UUID changed to:...".
Having got two new UUIDs you now need to edit the .vbox file for the virtual machine (usually located in the same directory as the .vmdk or .vdi file) using a text editor to inform the virtual machine of the new settings.
Near the top of the file locate the
Then towards the end of the file locate the
That’s it! Save the file and add the machine, with the duplicated virtual HDD, into VirtualBox.
Cloning avoiding the UUID Error
You cannot simply copy the dir containing the vdi drive and the other files because every machine must have a unique ID. There is a special command for this purpose:
On Linux
VBoxManage clonevdi fileorig.vdi filetarget.vdi
On Windows
%appdir%\VBoxManage clonevdi fileorig.vdi filetarget.vdi
%appdir% is generally C:\program files\VirtualBox.