I'm a big fan of VirtualBox. The tool enables me to extend a machine beyond its normal capabilities, test operating systems without getting invasive with my host, and kick the tires on various software titles without installing them on my production machine. But sometimes I get a virtual machine up and running and want to copy it (to move it to another machine or to have a second instance to test); when that time comes, I don't want to completely re-install the operating system and get it to the state I need. In this situation, I clone the virtual machine.
When you clone a drive, you make an exact copy of the virtual machine that can be used on either the same host or moved to another VirtualBox host. The process of cloning and moving a virtual machine is now easy in VirtualBox. In fact, there are no more commands for cloning, as the process is built into the GUI. I'll walk through this process and then move the resulting clone to another machine for use.
What you need
- VirtualBox installed (the host platform doesn't matter)
- A running virtual machine
- The ability to move the clone from one machine to another (shared drive, external drive, disk, etc.)
Cloning a virtual machineStep 1: Close the virtual machine
You cannot pause the machine that is going to be cloned and then clone it — the machine must be turned off.Step 2: Start the cloning process Select the virtual machine you want to clone in the left pane of the VirtualBox main window. Click the Snapshots tab (Figure A) and then click the small sheep icon. Figure A
A Ubuntu 12.04 virtual machine with no snapshots taken.The wizard that opens is a simple two-step process. The first step requires you to give the clone a name; you must give this clone a different name than the source virtual machine. By default, VirtualBox will append "clone" at the end of the name of the source virtual machine. You can keep this, and it should work fine. The second phase of the wizard asks the type of clone you want to create (Figure B). You will want to create a full clone, since our goal is to move this virtual machine to a new host. Figure B
Read carefully the difference between full and linked clones.Step 3: Locate and move the clone
You will be looking for a .vdi file. The location of this file will depend upon the host platform. On my Linux host, the file will be found in ~/VirtualBox VMs. Within that directory, you will find sub-directories of all your virtual machines. Within the virtual machine directory in question, you will find the .vdi file of the cloned virtual machines — that is, the file that must be moved to the new host. Copy that file to an external or shared drive and then copy it onto the new host (the location doesn't matter).
I'm almost finished adding my clone to a new host.
Once the new virtual machine is created, that virtual machine should fire up as expected and regardless of platform (I have tested this going from Linux to Linux, Linux to Windows, and Windows to Linux hosts).
The ability to clone and move virtual machines in VirtualBox as easily as shown above makes this a great tool for anyone who needs to expand their world with virtual machines. Give this a try and see how far you extend the reach of your hosts and guests with VirtualBox.
More about VirtualBox on TechRepublic
Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.