Cloning a VirtualBox Virtual Machine

Locating clear guidelines describing the proces of creating a copy of an already existing machine (also known as cloning it) is not an easy task. I gave up when I came across an unofficial guide or two.

In VirtualBox, virtual machine definitions are stored separately from disk images. Cloning the machine can be reduced to the matter of cloning the disk(s) and creating a new machine which uses the cloned disk(s). Since disk images contain a unique identifier (UUID) a simple copy – as performed by the operating system – won’t do. Instead, use the following command:

vboxmanage clonevdi ORIGINAL_IMAGE NEW_IMAGE

The default locating for disk images is ~/.VirtualBox/HardDisks and the files use the .vdi extension.

Example:

$ vboxmanage clonevdi ~/.VirtualBox/HardDisks/Disk.vdi ~/.VirtualBox/HardDisks/DiskClone.vdi
VirtualBox Command Line Management Interface Version 2.1.4_OSE
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: cd4972c2-b57f-4b59-90f3-db151ac131e5
$

Then create a new virtual machine which uses the DiskClone.vdi image.

Advertisements

Tags: , , , , , , ,

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s


%d bloggers like this: