Josh(ua Sarkis) Prowse

Technology. Education. Iambic Pentameter. 
« Back to blog

VirtualBox: How To Clone (Copy/Duplicate) a Virtual Machine (VM)

EDIT: Thanks to Peter Harrison who pointed out that the Import/Export Appliance feature of VirtualBox will effectively clone a VM right in the VirtualBox GUI. This post/video is now officially obsolete!

ANOTHER EDIT: According to Victor Gilette, the open source edition (OSE) does not include the Import/Export features in the GUI, so these instructions may be of help to anybody using that version.

If you are not a geek, stop reading now.

Hello geeks, if you're into virtualization, you probably have heard about VirtualBox. I love it, but making copies of my existing virtual machines is not automated the way it is with Parallels or VMWare. It's not too hard once you get the hang of it, but the instructions I've read aren't too easy to follow, so I put together a screen capture of the process and posted the movie to YouTube.

Hopefully VirtualBox will automate and integrate this process into the UI soon, but until then, these instructions should help you get started.

(The video was captured on my MacBook with iShowU, and all editing and voiceover done in iMovie '09.)

Loading mentions Retweet

Comments (13)

Jul 18, 2009
Peter Harrison said...
How is this different from exporting your VM as an appliance and then importing it again?
Jul 18, 2009
Josh Prowse said...
Hi Peter-- I just tried that, and apparently it's exactly the same thing. Hilarious that I had to post this video just to get somebody to describe a straightforward way to clone a VM. I'll update the post and use the import/export method from now on. Thanks very much for the tip!
Jul 18, 2009
Peter Harrison said...
I had not used virtualbox for a couple of years and returned to it only this week. Cloning a VM seemed essential and I found your video. I had already exported a machine to see if I could put it onto my laptop and thought it worth trying to import it back to the same computer. Seems to work anyway.

As far as I can tell, you can import several times if you want.

Jul 18, 2009
Josh Prowse said...
Yes it works very well. The only (very minor) caveat is that the exported VM will be in open vm format (vmdk) which means that you can't clone other formats using the import/export method. However, there might be a way to convert formats once the VM has been reimported? For me (and most people, I would guess) this isn't an issue-- I'm happy to use whatever format I can clone!
Aug 22, 2009
Sergio Cruz said...
Was about to watch your video, Josh. Thanks for updating the post and saving me a whole lot of work!
Aug 30, 2009
Victor Gillette said...
nice and useful video. It would help if you could also include the command in the body of the text, because I cannot read the command you type in the terminal window.
I installed VB OSE in my Ubuntu, and I do not see any Import/Export commands in the VBox GUI, I hope your lesson helps me. Thanks
Aug 30, 2009
Josh Prowse said...
Hi Victor, good suggestion. I added some annotations to the video for the terminal commands, and I hope that helps!
Sep 01, 2009
Bora Güngören said...
Actually VBoxManage clonedh has a "-remember" option. If you use it, the command automatically registers the cloned disk on the local VirtualBox media manager. Then you can simply change the virtual disk settings from the GUI.
Sep 01, 2009
Josh Prowse said...
Bora: thanks for the insight into that -remember option. I'm trying to perfectly reproduce my previous VM settings, and I don't trust my GUI attention to details :) so doing a straight file copy with the configuration file tweaks seemed like the best option.
Oct 13, 2009
MuH said...
Manyyyyy Thannkksss... now i can separate my services into VMs in a minute :P
Dec 18, 2009
George Entenman said...
Josh,

I just watched your terrific video at http://joshprowse.com/virtualbox-how-to-clone-copyduplicate-a-virtu

I tried very hard to clone VirtualBox VMs a year or so ago and finally gave up in favor of VMware because I had such a hard time cloning. It seems to me that there was a lot of weird stuff needed in order to get networking to connect to ubuntu VMs from OSX.

With your method, are the clones assigned different IP addresses from the originals?

I've finally gotten VMware to work the way I want - it was very hard - and cloning my VMs is very easy - a big win for me, but I'm still interested in VirtualBox.

Thanks!!
-- ge, chapel hill, nc,

Dec 22, 2009
Thomas said...
What when you have a VM with a history of snapshots and you want to clone them too? And I mean the full history and not the state, which one of the snapshots describes.
Feb 07, 2010
Josh Prowse said...
@George: If the clones are setup to use DHCP, they will each get their own IP address, but ONLY if you change the MAC address in the virtual machine. If you don't both clones will have the same MAC address, and this means that a network can't tell them apart. You can have VirtualBox generate a random MAC address in either the original or cloned VM's properties.

Leave a comment...

 
Got an account with one of these? Login here, or just enter your comment below.
Posterous-login    twitter