How to Clone Virtual Machine in Oracle Virtual Box


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 createcloning. Normal Full cloning and linked cloning. 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.

 

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”

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)      Register environtment variable into PATH variable, so you can use command vboxmanage clonehd. example on windows system :

4)      Run the following command. Here, I’m trying to cloneXP-FRESH.VDI disk in to same location (D:\My Virtual Machines\Virtual Box\XP-FRESH).

So, my command is below.

D:\My Virtual Machines\Virtual Box\XP-FRESH>vboxmanage clonehd XP-FRESH.vdi XP-FRESH_clone1.vdi

XP-FRESH.VDI – is original Windows 2008 R2 Server Installation disk

XP-FRESH_clone1.VDI – is the new cloning disk I’m creating.

5)      Add the cloned XP-FRESH_clone1.VDI to VirtualBox media manager (or just click refresh).

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

6)      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 (name : XP-CLONE1) and in virtual hardisk section, select “use existing hardisk” and choose XP-FRESH_clone1.VDI .

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s