Copying / Cloning VirtualBox 3 vdi files

If you need to create a new copy of a VirtualBox machine, i.e. clone the machine, do not copy the vdi files directly. If you do so, when you try to add the hard disk using the Virtual Media Manager you will get an error that an existing hard disk is already mounted.

VirtualBox stores a unique identifier UUID, similar to a GUID, within each vdi file and if it matches the UUID of an already mounted hard disk it will not allow you to add the copied hard disk.

The proper way to do this is through the command line VBoxManage utility. Strangely enough cloning functionality although available through this utility is not yet integrated into the GUI.

Anyway, before you can clone a vdi file make sure that there are no snapshots associated or if you have you need to merge all changes before you continue.

Here I show how to use the VBoxManage utility from a Linux terminal, in this case Ubuntu distro. If your host OS is Windows read Cloning and Copying VirtualBox virtual machines.

In Linux all you need to do is load the terminal, go to the location where the vdi file you want to clone is stored, and then execute the following command:

VBoxManage clonehd "original hdd.vdi" "cloned hdd.vdi"

That is all there is to it. Note that this process can take up quite some time. It all depends on the size of the vdi file you want to clone and your physical hard drive speed.

3 Comments

  • This method does *not* clone the machine. It only clones the disk.

    The machine state (size of RAM, shared folders, etc) are stored in the XML file for the virtual machine and must somehow be transferred into the XML file for the new virtual machine.

  • Minimalist Geek wrote:

    @NoName

    You are correct.

    I focused on the cloning of the vdi files since that is the most time consuming part. Creating a new virtual machine, configuring it, and assigning the cloned vdi file with it from the GUI is a one minute job.

  • Cloning is a waist of time you have to reactivate windows afterwards so it is a waste of time you may as well just make a new disk from scratch.

    After cloning you wont have network connection so drivers cannot be downloaded to make disk usable and it cannot activate.

    Same happens if you change the UUID so best to make a new virtual disk when its activated and patched make a read only copy as a backup of the original. If original dies or breaks you can just copy the backup and make it readable.

Post a Comment

Your email is never shared.