virtualbox.jpgIf you are reading this guide most probably you will know what Virtualbox is. But just in case let me tell a few words about it. VirtualBox is a cross platform application that allows you to create Virtual Machines. In other words VirtualBox runs on Windows, Linux, Macintosh and OpenSolaris hosts and supports a large number of guest operating systems such as Windows, Linux and OpenBSD. This means that you can run an Operating System through another at the same time. This is a very good way for experimenting and avoiding dual, triple or multiboot systems. I have already published two VirtualBox guides. The first one is How to install Ubuntu Linux on Windows using VirtualBox . The second one is How to resize a VirtualBox disk partition . In this tutorial I will explain how to copy a Virtual Machine's .vdi file so that you can backup it or transfer it to another system. With the same way you can also duplicate hard disk image file on the same host and quickly have a second Virtual Machine with the same setup.

The first thing that comes to ones mind is to simply copy the .vdi file of his virtual machine and then paste it in another system. However this might not work properly since VirtualBox assigns a unique identity number (UUID) to each disk image. Instead we are going to use the clonehd utility that comes with VirtulBox. This utility duplicates a virtual hard disk image to a new image file with a new UUID.

Cannot register the hard disk '/mnt/data/virtualmachines/VDI/Ubuntu 8.10.vdi' with UUID {a1ffe5a6-0d37-4e7e-97df-5bb5a331f411} because a hard disk '/mnt/data/virtualmachines/VDI/Ubuntu 8.10.vdi' with UUID {a1ffe5a6-0d37-4e7e-97df-5bb5a331f411} already exists in the media registry ('/home/axel/.VirtualBox/VirtualBox.xml').

Result Code:
IVirtualBox {339abca2-f47a-4302-87f5-7bc324e6bbde}

First make sure that the Virtual Machine you want to copy is powered off.

In File > Virtualdiskmanager, select the virtual machine disk image you would like to copy (1), press the Release button (2) and in the pop up window press again Release (3).

Now you should see that the image is Not Attached.

Linux users

If you are using VirtualBox in Linux open a terminal window and type:

VBoxManage clonevdi /location/your_virtualmachine.vdi /destination/your_virtualmachine_backup.vdiOf course you should replace location and destination as long as the vdi names with what you have in your system. clonevdi has replace the clonehd command, which however is still working since it is linked to the new one. Take a look at Location in the above screenshot to see where I had the virtualdisk image I wanted to copy. Depending on the size of your virtual hard disk this might take a while.

Windows users

If you are using VirtualBox in Windows go to Start -> All Programs -> Accessories -> Command Prompt. Here cd to where you have installed VirtualBox and then copy your oringinal .vdi to a new one:

cd "C:\Program Files\Sun\xVM VirtualBox"
VBoxManage.exe clonevdi "C:\Documents and Settings\your_username\.VirtualBox\your_virtualmachine.vdi" "C:\your_virtualmachine_backup.vdi"

Next we have to undo the Release we did before so that we can continue using our Virtual Machine. In VirtualBox main Window select the Virtual Machine (1) and press the Settings button (2). Go to Hard Disks (3) and press the Add button (4). Here select your initial .vdi file (5) and your Virtual Machine will be ok.

Now let's see how to import our backup .vdi. In the main window press the New button (1). Start creating a new Virtual Machine just like your previous one. In the Virtual Hard Disk window press the Existing button (2).

Next in the Virtual Disk Manager press the Add button and browse to where you have cloned your .vdi. Press Open to add it.

And then select it from the Hard Disks and press the Select button to attach it in your Virtual Machine.

Continue with the rest of the process. Once you are done you 'll see the VM you have transfered.

Before you boot into your VM you must change its settings. Unfortunately there is no way to backup your original settings so you will have to do this manually. Enjoy!

Comments (37)

Subscribe to this comment's feed
Former King of the World but now retired and fishing
Well, it worked once. :^> Now I'll try it again. Thanks for the help. Wonder why VB couldn't make it a simpler process????? Would sure make it easier.
Dave from Texas , May 15, 2009
I wonder the same and also for the resizing of a virtualbox disk.
axel , May 16, 2009
It's coming...
> Wonder why VB couldn't make it a simpler process????? Would sure make it easier.

They're working on it. What happened is that VBox added support for native VmWare VM files but this makes them regress in some of the features they used to support like shrinking VM files. Eventually these features will come back.
Markos , May 25, 2009
That's good news to hear Markos. Thanks for the info! smilies/smiley.gif
axel , May 25, 2009
Is there a command to perform the release / undo release, instead of going through point and click sequences ?

Stephan Wehner , July 08, 2009
Hi Stephan,

there are the VBoxManage openmedium / closemedium commands but I haven't tried them. Type VBoxManage --help in a terminal to get some info. They seem pretty simple.
axel , July 09, 2009
Great guide. Nice and simple to follow. Keep up the good work!
Ege , July 23, 2009
Thank you Ege! I am doing my best!
axel , July 24, 2009
Great Tutorial!
Was trying to figure out how to transfer my machines onto a new PC with fresh installation. Problem now solved, thanks to you! smilies/smiley.gif
PC Rescue , August 22, 2009
Use full file paths, NOT relative
Hey Axel - thanks for the guide, really helped. One point is that when you're using clonevdi you can't use relative paths for the .vdi files, you seem to need to put the full path.
Ben , September 07, 2009
Hey Ben, I should have made it clearer that the full path is needed when I wrote /location and /destination. You are right. Thanks. smilies/smiley.gif
axel , September 08, 2009
Reattach a with snapshots
I have an image that has several snapshots associated with it. my OS got screwed up and I had to reinstall. I have the VB hard disk and the machine with all of the snap shots, but I cannot figure out how to reattach it. I tried by creating a new machine and attached the vdi file from the hard disk folder, but it was the original snapshot of the system. Is there a way to just reattach my machine XML and have it come back to life?
brian , September 11, 2009
I'm sorry brian but I haven't tried something like this.
axel , September 13, 2009
Licensing Issues with Windows XP?
Not sure if this is a stupid question, but will cloning an XP virtual machine in this matter cause any licensing issues? In other words, will Windows XP on the clone still think it's on the exact same machine?
Jazz , September 26, 2009
No stupid question at all Jazz. As far as I remember Windows XP allows you to use each license only in one Virtual Machine. I don't know what happens with Vista and Windows 7. There might be different cases for different versions as well, e.g. Home edition, Ultimate etc.
axel , September 26, 2009
I see! Firstly, thank you for your prompt response!

I'm interested in backing up my virtual machine (which has a legitimately activated Windows XP install). Would straight up copying the .vdi suffice to this end if I either attached the backed-up .vdi (with the identical UUID) to the old guest machine, or deleted the old VM and made a new one with exact the exact same configuration?

My concern is that I must use certain Windows apps with a lot of my school work. Even being pointed in the right direction would be a huge help!
Jazz , September 27, 2009
I think that you won't have a problem on both cases.
axel , September 27, 2009
Thanks for all your help! smilies/grin.gif
Jazz , September 29, 2009
You are welcome! smilies/cheesy.gif
axel , September 29, 2009
Okay, I'm back to bother you again! Do you think exporting a virtual machine through the "Export Appliance" option would be a good way to back up a machine?
Jazz , September 29, 2009
I'm sorry Jazz but I haven't tried export appliance. I don't have an opinion about that. smilies/sad.gif
axel , September 30, 2009
No prob!
Hey man don't worry about it. You've been very helpful and I definitely appreciate it! smilies/grin.gif
Jazz , October 05, 2009
Thanks Jazz! Once you are finished with it drop me a line here to know what you did. smilies/cheesy.gif
axel , October 06, 2009
Thanks for this guide thanks thanks smilies/smiley.gif
apache , October 15, 2009
You are very welcome! smilies/cheesy.gif
axel , October 16, 2009
The same using CLI
# hardwired script - master image is "Venus" want to clone it to "Neptune"
echo "Release HDD from Venus"
VBoxManage --nologo modifyvm "Venus" -hda none
sleep 1
echo "Unregister HDD from Venus"
VBoxManage --nologo closemedium disk /home/vmadmin/.VirtualBox/HardDisks/Venus.vdi
sleep 1
VBoxManage --nologo clonehd /home/vmadmin/.VirtualBox/HardDisks/Venus.vdi /home/vmadmin/.VirtualBox/HardDisks/Neptune.vdi
sleep 1
echo "Cloning finished... re-register HDD to Venus"
VBoxManage --nologo openmedium disk /home/vmadmin/.VirtualBox/HardDisks/Venus.vdi
sleep 1
echo "Re-attach HDD to Venus"
VBoxManage --nologo modifyvm "Venus" -hda /home/vmadmin/.VirtualBox/HardDisks/Venus.vdi
sleep 1

echo "Now the new machine (HARDWIRED TO Neptune)"
echo "Create the new VM"
VBoxManage --nologo createvm -name "Neptune" -register
sleep 1
echo "Parametrize new VM"
VBoxManage --nologo modifyvm "Neptune" -memory "256MB" -acpi on -boot1 disk -nic1 nat
sleep 1

VBoxManage --nologo openmedium disk /home/vmadmin/.VirtualBox/HardDisks/Neptune.vdi
echo "Attach recent clone copy of Venus, now named Neptune.vdi to new VM"
VBoxManage --nologo modifyvm "Neptune" -hda /home/vmadmin/.VirtualBox/HardDisks/Neptune.vdi
echo " You are set !! "

NOTE: Run this as vmadmin user belonging to group vboxusers.
dramirez , November 05, 2009
Many thanks dramizez! This script will help many users to clone their Virtual Machines easily!

If anyone else wants to use it save the above commands in, let's say Make this file executable: chmod +x and run it like this ./

Don't forget to replace the VirtualBox Machine names with yours.

Thanks again dramirez! smilies/smiley.gif
axel , November 07, 2009
virtualBox questions
Thanks for great help!
1. with regards to DRAMIREZ script, any hopes to have similar for Windows?

2. Just created XP-Pro SP3 legitimate VM. If I continue building it with Office 2003, Studio10, Adobe Premier, etc., how can I create a final image to install in my PC if it dies, as the "real" OS, not as a VM?

Thanks again for your great insight.

Luigi , November 25, 2009
Hi Luigi,
1. You can create a .bat file in Windows with those commands and run it in Windows.

2. I don't know a way to do this. smilies/sad.gif
axel , November 25, 2009
Thanks a Bunch!
Thanks a bunch! That would have taken me days to figure out!

Thank you!

Scott R. , December 10, 2009
a Virtual Disk Image is not a Virtual Machine
since a VM can have multiple drives attached, has settings and a history of snapshots. A VDI is only a virtual disk image. So this guide does less than half of the job.
Thomas , December 22, 2009
Thanks for a very interesting informative tutorial!

One of the best I've seen of VirtualBox, good work fellows!

Have a short question regarding recover a system from Snapshots.

Does it exist a workaround to use an old Snapshot to reinstall the OS on a new blank clean created virtual harddisk image?

I've recently lost the harddisk image file .vdi and when trying to reinstall I receive error messages from failing UUID difference between the new and the old disk image. Someone who knows how to replace uuid on a disk image?
Thanks in advance!
Breanna , May 28, 2010
Hi Breanna, I'm sorry but I don't know if this is possible. Maybe you could post a question in the official forums of VirtualBox. smilies/smiley.gif
axel , May 29, 2010
making machine
Automated ice machines is non-corrosive and has lengthier services existence. Regarding the approach to salt h2o ice generating, the brine tank ought to be taken care of each year, meanwhile, ice buckets also have to be altered every single 4 a long time.

ice , May 15, 2011
Thanks for sharing the info
it worked superbbb for me !!! good to find transferring the vdi in a single shot .
malathi , October 03, 2011
Export appliance
It's easier if you click File->Export Appliance and save the file into your USB.
Insert your USB into the computer you want to transfer your virtual machine, then you click File->Import Appliance

And everything will be the same, no need to do anything else.

marco ortega , March 21, 2012
Very informative post! Thank you for postign this article.
Honey Clarkson , January 09, 2013

Write comment

smaller | bigger
security image
Write the displayed characters


General Software

Login Form

Follow me on...

  • Facebook
  • Twitter
  • Google+: u/0/b/113039112812192417058/
  • Digg
  • Reddit: myguides
  • RSS Feed
  • e-mail

Member Login