woensdag 9 september 2009

Clone a virtual machine in VirtualBox

I have a 'standard' virtual machine with XPsp3 running under Sun's VirtualBox. Now I want to test Mule ESB, so I need a clone of this virtual machine to build Mule ESB on. I have the virtual hard disk file in .VHD format to keep it compatible with the company's standard (but less good) VirtualPC.

I started simple by copying the WinXPtest.vhd to WinXPMule.vhd. Then into VirtualBox, New Virtual Machine, use existing harddisk, add the WinXPMule.vhd to the device list, BANG! ERROR! Problem turns out to be that both have the same id.

Luckily some guy Stuart explained on his blog how to do this by way of the vBoxManage.exe. He suggested the use of the clonevdi command, but checking the commandline help of vBoxManage I found the clonehd command. So I entered (include the double quotes):
"c:\program files\sun\VirtualBox\VBoxManage.exe" clonehd WinXPtest.vhd WinXPMule.vhd --format:VHD --variant:Standard --type:normal.
I actually don't know the meaning of the --variant and --type parameters, but Standard and normal sounded quite right. It took some time (copying a file of nearly 4GB always takes some time), but then the command returned with "Clone hard disk created in format 'VHD'. UUID: (some not very interesting GUID)"

Back to the VirtualBox program, New Virtual Machine, use existing harddisk, add the newly created WinXPMule.vhd to the device list - no error this time - and you're done.

Geen opmerkingen: