Virtualbox: the ‘correct’ way to clone machines.

I recently had to clone a virtual machine and did my usual copy and paste. Not the best idea. Virtualbox, my preferred virtualization solution, definitely did not like that approach as each machine image has its own uuid which is stored in the actual image… The right way to do it is with the clonehd tool. That said, if the uuid is ‘in’ the file in theory it should be editable and when I have time I intend to test that theory out.

The actual steps to clone a machine on a windows (concept is the same for FreeBSD and OS X) host are as follows.

  1. Open a Command Prompt window on the host machine.
  2. Change to the VirtualBox VDI directory (you do know where your images are…? and you know what spindle contention is…?)
  3. Run the VBoxManage command with clonevdi command option. The following example shows the creation of a copy of Server_2008.vdi named Server_2008_Base.vdi.

“C:Program FilesSunxVM VirtualBoxVBoxManage.exe” clonevdi “Server_2008.vdi”

Which then produces a not very informative dialogue box…

VirtualBox Command Line Management Interface Version 2.0.4 (C) 2005-2008 Sun Microsystems, Inc. All rights reserved.


And that’s it.