Clone guest operating system (VDI) disk VirtualBox

This tutorial will show you how to clone guest operating system (VDI) under VirtualBox.
I started using VirtualBox before time and now I am running all virtual machines on it. VMWare workstation configuration is rather easy, but I am happy with VirtualBox performance.

Anyway, when I first tried to clone host machine created in Virtualbox, I tried the lame method, just to copy and paste the VDI file. Certainly I received an error saying that the UUID conflicts with the image. VisrtualBox is using XML files to store such data, but do not edit the VirtualBox configuration files manually – the files are cross-connected and making changes manually will take you a lot of time and still errors may occur. The best option is to use the VirtualBox commands instead.

VBoxManage has command line utility called clonevdiâ„¢ can clone and register the disk image.
To perform this command you must go to Start -> Run and there type cmd.
Then change to the directory where are the guest OS hard drives (usually C:\Documents and Settings\%user%\VirtualBox\HardDisks).

To run the \"clonevdi\"â„¢ tool you must execute it from its location. In my case bellow I am cloning Windows 7 virtual machine.
Here is the command I am using:

Take a look at my command and make changes as per your configuration. Do not forget to use quotes especially in case you have spaces within the names of your files and folders. Otherwise the VirtualBox clone command will not work.
Once executed it takes some time depending on the size of the cloned guest OS. The output looks like this:

Do not forget to create new virtual machine in VirtualBox and during the creation to add the cloned drive instead of a new one.

Tags

Filed Under: Virtual box

Anthony Gee About the Author: Anthony G. is an IT specialist with more than 9 years of solid working experience in the Web Hosting industry. Currently works as server support administrator, involved in consultative discussions about Web Hosting and server administration. One of the first writers in the Onlinehowto.net website, now writing for Free Tutorials community - he is publishing tutorials and articles for the wide public, as well as specific technical solutions.

Comments (2)

  1. Sam says:

    Great tutorial, thanks! However, it took my quite a while to get past the error message “Cannot register hard disk because it exists in c:\users\username\.virtualbox\virtualbox.xml”. I unmounted all the virtual images in media manager and even deleted the virtual machines. What I finally had to do was rename the .xml file and then it worked like a charm.

    Many thanks!

  2. Fedor says:

    works fine. one note – since Sun is now Oracle the path is changed:

    C:\Program Files\Oracle\VirtualBox\VBoxManage.exe

Leave a Reply