How to Clone a VirtualBox Virtual Machine on OS X


I’m working on my automatic deployment scripts and decided to do some work using local VirtualBox VM’s rather than doing everything in the cloud. The cloud part all works just fine, so there’s no point wasting bandwidth (and money) proving it out a hundred times.

Thing is, it took almost an hour to get a stupid VM set up with stupid Ubuntu 10.04 and updated to latest stupid versions of stupid everything.

So I wanted to just clone my perfectly prepared VirtualBox machine.

Conflicting info on the web led me to the following very simple solution:

Go to ~/Library/VirtualBox/HardDisks. This is on OS X, so if that’s not where they are for you, go where they are.


# VBoxManage clonehd old.vdi new.vdi

This updates the uuid and such as it makes the copy, so it avoids a whole bunch of problems half of the posts I found were trying to work around.

Create a new VM from the VirtualBox menu, set the drive to the new clone, and fire it up.

So far, it boots, but networking is all broken and I remembered having EXACTLY this same problem under Parallels.

Same, problem, same solution, done: Fixing Cached Stupid Network Info.