How-to: Clone a Virtual Machine in VirtualBox
"With Oracle VirtualBox 4.1 cloning a virtual machine is now available from the user interface making the process much simpler. In prior releases cloning avirtual machine was a multi step process in which you needed to use the command line utility VBoxManage clonehd to create a clone of the virtual device and then attach that new image to new virtual machine."
Cloning a virtual disk or machine in VirtualBox used to be a royal pain; achievable, but complex. You had to know the guest operating system and whether it was a 32-bit or 64- bit machine when creating the new virtual machine.
The new method for cloning a virtual machine is much simpler and less error prone. Cloning provides the opportunity to spawn new instances of existing virtual machines.
The latest version of VirtualBox (4.1.x) adds a Clone command which simplifies matters immensely for straightforward cloning (although fine-grain snapshot management will benefit from doing things by the old-fashioned, tedious manual methods).
Note: make sure to shut-down any virtual machine before you run any kind of cloning or copying!
To clone a virtual machine, right-click it in the main VirtualBox window and select 'Clone' from the context menu.
The new graphical tool in VirtualBox will present the cloning options:
- choose a Full Clone which includes all virtual disk images as well as the configuration for the machine virtual hardware (memory, processor, networking, and so on), the operating system type, 32bit or 64bit arhictecture.
- choose a Linked Clone to copy just the virtual machine hardware minus hard disk images; the virtual clone will point to the existing virtual disk images. You need to be careful with this and be sure you understand the implications of having two virtual machines attached to the same set of storage.
Cloning will assign different machine id's and device id's in the contextof virtual disks, so that VirtualBox can keep its' inventory straight.
To copy a virtual disk on its own, you need a different utility; select File > Virtual Media Manager, right click a .vdi disk image in the list then select 'Copy'
Do not delete your original virtual machine or disk until you have tested the new clone for reliability. When you start the new (cloned) virtual machine or virtual disk, run precautionary disk checks (chkdsk or fsck) before starting any work on real data. RC