VirtualBox On Windows: Clone A VDI

Updated on the 2nd of August, ’11: Recent versions of VirtualBox have changed the way the cloning works, so the instructions below no longer work. Never fear, some smart chap has built a GUI application to handle the cloning and as an added bonus it also lets you decided if you want to generate a new UUID or keep the old UUID. It also lets you increase the virtual drive size, amongst other things. No official website for this tool, but the guy who built it has a forum thread at virtualbox.org and it can be downloaded from here as well.

I’m using VirtualBox to create multiple virtual machines that I can use on my computer. All of these VM’s will be quite similar, but used for different purposes. One might be for web development, the other might be for games and the other might be for smart phone apps development. It’s one way of ensuring that my primary machine does not get cluttered and slowed down by a gazillion different applications and services running in the background.

One minor issue that I can into was cloning a VDI in VirtualBox. Simply copying and pasting the relevant files in Windows Explorer does not work, as each hard disk must have a unique UUID — copy/paste duplicates the unique UUID and so you can’t add the duplicated HD into the VirtualBox Manager as it conflicts with the original HD.

So you need to power up the Command Prompt and use the VBoxManage command with the clonevdi command option.

  1. Open the Command Prompt
  2. Move to the directory which contains the VBoxManage.exe file, possibly at this location: C:\Program Files\Oracle\VirtualBox
  3. Type in this command and press Enter: VBoxManage clonevdi “<path>\original.vdi” “<path>\cloned.vdi”

That’s it. The cloning process should begin. Now go get yourself a coffee, if the VDI is large it’ll take a little while to clone.