How to Clone Virtual Machine in Sun VirtualBox- Simple Steps

This post explains how to clone Virtual Machines in Sun VirtualBox in same host with very simple steps.  The Open source desktop virtualization software VirtualBox is not having GUI virtual machine cloning option as VMware workstation.

What is Cloning of Virtual Machine?

Cloning virtual machines allows duplicating pre installed and configured virtual machines very easily without re installing OS and other programs. This is the ideal method to create multiple similar virtual machines in short time.

VMware workstation has two options to create cloning. Normal Full cloning and linked cloning. More information about VMware workstation cloning is available here. Sun VirtualBox cloning is slightly different which involved two steps are.

1)      Clone the hard disk of existing virtual machine

2)      Create a new virtual machine with cloned Hard disk.

How to clone Virtual Machine in Sun VirtualBox- Simple Steps

VirtualBox hard disks saved as VDI files in virtual machine location. Cloning these.VDI files doesn’t mean copying and pasting these files. Duplicating these VDI files by Windows copy paste method doesn’t work since each VDI files have unique UUID which should not duplicate in Sun VirtualBox in same host. There for, we have use a tool called ‘clonehd’ to duplicate VDI files with different UUID.

When I tried to import the duplicated VDI files by Windows copy paste option, I get following error when try to import to VirtualBox media manager.

Clone Virtual Machine Sun VirtualBox

Follow the steps to clone Virtual Hard disks in VirtualBox properly.

1)      Remove the virtual disk from Virtual Media manager in Sun VirtualBox.

Go to media manager, select the disk you want to clone, if ‘Remove’ is disabled, first Press Release and Remove. Make sure you DO NOT delete the disk file.

Clone Virtual Machine Sun VirtualBox

2)      If you run clonehd command without removing from media manager, you may get following error message. “already exists in the media registry”

Clone Virtual Machine Sun VirtualBox

3)      Run the following command. Here, I’m trying to clone Windows2008R2.VDI disk in to same location. I set the Windows Operating System Path to C:\Program Files\Sun\VirtualBox\ already.

So, my command is below.

C:\Users\Dinesh\.VirtualBox\HardDisks>vboxmanage clonehd Windows2008R2.vdi Windo


Clone Virtual Machine Sun VirtualBox

Windows2008R2.VDI – is original Windows 2008 R2 Server Installation disk

Windows2008R2_Clone.VDI – is the new cloning disk I’m creating.

4)      Successful virtual machine hard disk cloning will return 100% completed message and same size VDI file can be found in the location.

Clone Virtual Machine Sun VirtualBox

5)      We successfully cloned the hard disk only, not complete virtual machine. To complete cloning of virtual machine is sun virtual box; we have to create a new virtual machine.

In this example, let’s create a new Windows 2008 R2 64 Bit virtual machine with very similar configuration of original virtual machine, but instead of creating new hard disk, select the cloned hard disk in media manager.

Read more about creating and installing Windows 2008 R2 64 Bit on VirtualBox

6)      Add the cloned Windows2008R2_Clone.vdi to VirtualBox media manager.

Go to media manager, press add and select the VDI file.

Clone Virtual Machine Sun VirtualBox

Now, I don’t get any error messages about registering UUID, because both disks have different UUIDs and clonehd command done the job.

Start the newly created (Actually cloned) virtual machine, it will work fine.

The above simple steps to clone virtual machines in Sun VirtualBox, helps lot on reducing time on creating virtual machines.

Now, I have one simple question for you. The original VDI file is not having snapshots of virtual machine, it means, if you clone the original hard disk file when there are snapshots available, you will not get the latest virtual machine as a clone machine. Then how to make a latest clone machine from snapshots in Sun VirtualBox?

Any idea? I have. Keep visiting my blog or subscribe now.  I will be updating later.

4 thoughts on “How to Clone Virtual Machine in Sun VirtualBox- Simple Steps”

  1. Hi Jeremy,
    Thanks for your information,. Yeah, I heard about it. Already downloaded, let me test and post a tutorial about it.
    Thanks again and keep visiting my blog.

Comments are closed.