Cloning and Copying VirtualBox virtual machines
Change History
2013-12-08: Updates.
2011-09-22: Updates.
2008-11-03: Updates.
2008-11-01: First draft.
This article explains how to clone and copy VirtualBox VMs (virtual machines).
Update December 2013: An easier way to merge snapshots Verified this technique with VirtualBox 4.3.4. VirtualBox has come along since I fist posted this article back in 2008 (Version 2.0.4) — the latest version of VirtualBox (4.1.2) adds a Clone command which largely renders the techniques described below redundant and hugely simplifies matters (although they will still be useful if you are interested in fine-grain snapshot management). Here’s the procedure to merge and compact all the snapshots to a new VM containing a single VDI file:
|
Problems with 64-bit Windows 7 Guests with .vdmk disks This note is off-topic but it may be of help to anyone experiencing this problem (sorry, I don’t have a solution, apart from don’t put 64-bit Windows VMs into After importing a
|
The techniques described in this article were tested on a Windows XP Pro SP2 host operating system using VirtualBox version 2.0.4. The details may vary if you use a Linux or some other host OS.
Introduction
Cloning and copying VirtualBox VMs is not as straight forward or obvious as it is with VMWare Desktop and this subject has created a lot of confusion in the support forums. This is because:
- There is no single VirtualBox command for VM cloning.
- The documentation is vague.
- A couple of the VirtualBox commands are poorly named.
The good news is that the underlying technology is just great and with a little understanding copying and cloning VMs is quite easy.
This article explains how to copy an existing VM containing an installed and configured guest OS. Before starting it helps to have a basic understanding of VirtualBox virtual machines.
Virtual Machines
A VirtualBox VM consists of three parts:
- One or more virtual hard disk image files (VDI files).
- Zero or more Snapshots (also VDI files).
- XML configuration files defining the VM (virtual hardware parameters).
Snapshots
- A snapshot bookmarks the state of the VM (specifically the VM file system) at the point in time the snapshot is made.
- You return to a previous snapshot by deleting the current state and all newer snapshots.
- When you create a snapshot, changes to the file system accumulate in the current snapshot file, older snapshot files and disk image files are effectively read-only.
- If there are no snapshots the VM’s disk image file accumulates file system changes just like normal disks — the VM’s Current State is merged into the disk image automatically when you close the VM.
With respect to copying the important thing to understand about snapshots is that there is no easy way to copy them, so if your source VM has any snapshot information that you want to copy you first need to merge the snapshot(s) into the source VM’s disk images.
Copying a Virtual Machine
Here’s an outline of the copy process:
- If the source VM has any snapshot information that you want to copy you first need to merge the snapshot(s) into the source VM’s disk image files.
- Make a clone the source VM’s disk image file(s).
- Create a new VM and attach the cloned disk image file(s).
Here are the details:
Merge source snapshots
Here’s how to merge the source snapshots to the source disk image VDI file (skip this step if you source VM doesn’t have any snapshots).
- If the source VM is running close it.
- From the VirtualBox window select the source VM then click the Snapshots tab.
- If you want to include the current state of the disk in the merge save it as a snapshot by selecting the Current State then executing the Take Snapshot (Ctrl+Shift+S) command.
- Select the most recent snapshot you want to include in the target VM and execute the Discard Snapshot (Ctrl+Shift+D) command. This merges the snapshot file into it’s parent VDI file (snapshot or base disk).
- Repeat the previous step, working your way down the snapshot list until the oldest snapshot has been merged into the base VDI.
The VirtualBox snapshot commands are poorly named, in particular the inconsistent and confusing use of the word Discard:
Command | Should be named | Applied to | Description |
---|---|---|---|
Discard Snapshot (Ctrl+Shift+D)
|
Merge with Parent
|
Snapshot
|
Merges the snapshot file into the parent snapshot or disk image file and then deletes the now redundant snapshot file.
|
Revert to Current Snapshot (Ctrl+Shift+R)
|
Current State
|
Deletes the current state returning the VM state to the most recent snapshot.
|
|
Discard Current Snapshot and State (Ctrl+Shift+B)
|
Delete Current Snapshot and State
|
Current State
|
Deletes the current state and the most recent snapshot returning the VM state to that of the penultimate snapshot. Use this command to delete snapshots.
|
Clone or copy the source disk image
At this point the entire state of the source VM that we want to copy is contained in the disk image VDI file.
To avoid confusion I use the term copying to refer to copying a VM to different host machine and the term cloning to refer to creating a copy on the same host.
Copying to another host machine
If you want to create a copy on another host machine you simply copy the disk image to the new host.
- If the source VM is running close it.
- Copy the source disk image to the VirtualBox VDI directory on the target host machine. You’ll normally find the source disk image in the VirtualBox VDI directory (the standard VDI location on Windows hosts is
C:\Documents and Settings\<username>\.VirtualBox\VDI
).
Once you’ve copied the disk image you need to register it with VirtualBox on the target host machine:
- From the VirtualBox window select File→Virtual Disk Manager (Ctrl+D) menu command.
- Press the Add button and select the copied disk image file.
Creating a clone on the same host machine
Use the VBoxManage
command-line utility the clonevdi
command option to clone and register the disk image (you can’t just copy the disk image to the same host machine because the disk UUID will conflict with the source disk image):
- Open a Command Prompt window on the host machine.
- Change to the VirtualBox VDI directory (normally
C:\Documents and Settings\<username>\.VirtualBox\VDI
). - Now run the
VBoxManage
command with theclonevdi
command option. The following example transcript shows the creation of a copy ofUbuntu 8.04.vdi
namedUbuntu 8.04 clone.vdi
and registers the new disk:
C:\Documents and Settings\srackham\.VirtualBox\VDI> "C:\Program Files\Sun\xVM VirtualBox\VBoxManage.exe" clonevdi "Ubuntu 8.04.vdi" "Ubuntu 8.04 clone.vdi" VirtualBox Command Line Management Interface Version 2.0.4 (C) 2005-2008 Sun Microsystems, Inc. All rights reserved. 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% C:\Documents and Settings\srackham\.VirtualBox\VDI>
My experience is that merging snapshots into a single base VDI saves a lot of space (a Windows XP guest with 5 snapshots shrank from 8.6GB to 3.7GB) but defragging the drive and then running the VBoxManage
modifyvdi compact
command didn’t appear to regain any disk space in either Windows XP or Vista.
Create a new virtual machine
There is no command to copy a VM so we create a new VM and attach our copied disk to it:
- From the VirtualBox window select Machine→New… (Ctrl+N) menu command.
- Work your way through the Create New Virtual Machine wizard till you get to the Virtual Hard Disk page then press the Existing… (not the New…) button and select the disk image VDI file that you previously cloned or copied.
That’s it, you should now be able to start and run your new VM.
Warning |
Try not to be tempted to edit the VirtualBox XML configuration files manually — the files are interrelated and making changes manually is not as easy as it looks (I’m talking from experience here) — best to use the VirtualBox commands instead. |
Final Thoughts
Although I have not tried, it should be relatively easy to automate the copying and cloning procedures by scripting the powerful VirtualBox VBoxManage
command.
December 7, 2008 at 9:04 am |
Stuart,
Excellent article. Wish I had read this article earlier.
After I have cloned the vdi; I have realized that the snapshots are not considered. I deleted the snapshots altogether now so will have to start from scratch.
Many thanks for this note.
Cheers, Sham
December 13, 2008 at 6:41 pm |
Excellent, thanks for posting this, it worked like a charm!
December 14, 2008 at 5:05 pm |
one thing to note here also is that you can create lots of clones at once but it takes forever, I ran the script to create 5 machines and it took almost 4 hours for machines with only 20gig vdi files, ouch! Otherwise it takes about 30-40 minutes to do one at a time.
November 21, 2017 at 7:34 pm |
Experiment with a timeout buffer, this actually speeds things up. I believe it is to do with exhausting the burst capability on the SSD. You will notice the initial clone creates, quickly then a downturn. either way, clone1…timeout…clone2 allows the system to recover and deliver the second clone more quickly.
January 1, 2009 at 7:03 pm |
I tried to clone one of my drives – host is Vista Home Premium guest is XP Pro. While it was very easy to create the original, I wanted to make a clone of it so I can run tests without having to reenstall XP each time. In VMWare, I merely create a copy renamed it and VMWare reasigned the identifier. The technique named above did indeed allow the copy to be made (clonevdi Virtualbox version 2.1) – – but it would not run. My script was:
“C:\Program Files\Sun\xVM VirtualBox\VBoxManage.exe” clonevdi “XP_Pro_Org.vdi” “XP_Protest2.vdi”
The message on a black screen was:
“Windows could not run because of an error in the software. Please report this problem as: load needed DLLs for kernal. Please contact your support person to report this problem.”
What went wrong?
September 23, 2010 at 10:46 pm |
Thanks Ed!
I first tried clonevdi command but I got an error because I had copied the vdi file on a different partition but the HDUUID was already registered so it didn’t work. Then I read your comment and the problem was resolved!
So, this command is very useful and works fine…
VBoxManage.exe” internalcommands sethduuid “virtualHDName.vdi”
Okay, right now I am checking out the cloned / duplicate Guest OS. Thanks to you again!
January 2, 2009 at 2:13 am |
I have read the internet literature and have found a workaround that works!
In windows copy to the drive and rename it to what you need. Then get a command screen to the directory that houses the drive(s). Use:
“C:\Program Files\Sun\xVM VirtualBox\VBoxManage.exe” internalcommands sethduuid “xp_protest.vdi”
This will change the uuid of the drive. “XP_protest.vdi” is the copy of the disk file, as I named it on my system. Now I am free to start using VirtualBox without fear of losing data. You must go through the creation of the drive with “add” and “existing” in the proper places…
You can copy a file from another computer or a backup of your own making by manually doing what VMWare does automatically – recreate the uuid! But pricing on VirtualBox is much lower! It does all I need in a much easier way than VMWare. The only hangup was the backup/transfer from/to another compute, with which I had a problem. Now that that is over – I am a happy man!
August 26, 2010 at 4:57 am |
Thanks, Ed! This worked perfectly for me (Vb version 3.2.8 r64453)
1. Copy your VDI, rename if necessary
2. Run the command line below (note change in path for my version)
“C:\Program Files\Oracle\VirtualBox\VBoxManage.exe” internalcommands sethduuid “whatever your VID is called.vdi”
3. In VBOX – File, Virtual Media Manager, New, point to your new VDI copy.
4. In VBOX – Machine, New, Use Existing HD, Select the new file/media you added above in step 3. BINGO! Happy Cloning…
The Rosinbag
January 3, 2009 at 1:57 am |
Thanks for the awesome write-up. I’d read several other pages on this topic but was still confused until I read yours.
January 9, 2009 at 8:23 pm |
Thanks for this; it helped a lot.
One thing I ran into was a cryptic error trying to clone:
[!] FAILED calling virtualBox->OpenHardDisk2(src, srcDisk.asOutParam()) at line 372!
[!] Primary RC = VBOX_E_IPRT_ERROR (0x80BB0005) – Runtime subsystem error
[!] Full error info present: true , basic error info present: true
[!] Result Code = VBOX_E_IPRT_ERROR (0x80BB0005) – Runtime subsystem error
[!] Text = Could not get the storage format of the hard disk (VERR_FILE_NOT_FOUND)
[!] Component = HardDisk2, Interface: IHardDisk2, {ed6e2525-c2fd-42a4-917a-7a9045ac9e15}
[!] Callee = IVirtualBox, {339abca2-f47a-4302-87f5-7bc324e6bbde}
Apparently the directory where the VDI files changed from 1.x to 2.x and by default VBoxManage only looks in the new location. When I gave the full path for the source, it was able to find and clone it properly.
Hope it helps someone.
Cheers,
Harley Pebley
January 17, 2009 at 12:22 am |
Thanks a lot. You got this exactly right. Both the nomenclature and the steps of the process are non-intuitive. VB 2.1 VBoxManage also has an internal command to change the UUID of a copied vdi file: “VBoxManage internalcommands sethduuid copiedfile.vdi”
This worked successfully for me.
Thanks again for the clarity.
January 27, 2009 at 1:21 pm |
I’m getting an error message trying to use the clonevdi command:
C:\Documents and Settings\user\.VirtualBox\VDI>”c:\Program Files\Sun\xVM Virt
ualBox\VBoxManage.exe” clonevdi “Windows XP Pro.vdi” “Windows Vista.vdi”
VirtualBox Command Line Management Interface Version 2.1.2
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.
[!] FAILED calling a->virtualBox->OpenHardDisk2(src, srcDisk.asOutParam()) at line 369!
[!] Primary RC = VBOX_E_IPRT_ERROR (0x80BB0005) – Runtime subsystem error
[!] Full error info present: true , basic error info present: true
[!] Result Code = VBOX_E_IPRT_ERROR (0x80BB0005) – Runtime subsystem error
[!] Text = Could not get the storage format of the hard disk ‘C:\Documents and Settings\user\.VirtualBox\HardDisks\Windows XP Pro.vdi’ (VERR_FILE_NOT_
FOUND)
[!] Component = HardDisk2, Interface: IHardDisk2, {ed6e2525-c2fd-42a4-917a-7a9
045ac9e15}
[!] Callee = IVirtualBox, {339abca2-f47a-4302-87f5-7bc324e6bbde}
C:\Documents and Settings\user\.VirtualBox\VDI>
February 15, 2009 at 7:54 am |
Thanks for the tips. I agree with your point that the naming conventions for handling snapshots should be changed. Why ‘merge’ is labeled as ‘delete’ I really don’t know.
February 17, 2009 at 2:24 pm |
Hi,
Thanks for an excellent write up – this cleared up a lot of confusion for me. One thing I found was that when creating a clone on the same host machine, I had to run the VBoxManage command from one directory further up the tree i.e. from the .VirtualBox directory. If I tried to run it from the VDI directory I got a VBOX_E_IPRT_ERROR (Could not get the storage format of the hard disk). I’d imagine this is due to a path problem. Obviously then you need to add “VDI\” before the name of the original and cloned files.
Al
February 27, 2009 at 4:40 pm |
Very helpful instruction. I just follow your steps and make it work without problem. If only they can just create a simple “clone” button next to each of the snapshot, then we will be all set.
Thanks for this blog.
March 2, 2009 at 10:03 am |
Thank you! This helped ALOT! I don’t understadn why they just didn’t have a “clone” button in the UI ??
Anyway, thank you, you saved me a lot of time :)
Regards
March 8, 2009 at 10:16 am |
Thanks! Very usefull instructions set, even for me, Mac OS X user. =)
March 10, 2009 at 3:13 pm |
Thank you, thank you and Thank you. This page must be bookmarked by all VirtualBox users.
It turns out that the scariest option “Discard” does exactly the opposite (meaning it save instead of throwing away)
I have lost 2 days of work because of the confusing wording of the snapshot GUI in VirtualBox 2.14. Definitely there is a translation issue on the wording of the snapshot options. Must use clear words like “Merge”, “Commit”, “Rollback” rather than “Discard”. Also the VBoxManage clonehd must allow an option to clone from the LATEST snapshot.
March 12, 2009 at 3:51 pm |
GREAT!!!! This saved my day!!!! I also got tricked by the misleading use of ‘discard’ in Virtualbox!!
March 14, 2009 at 10:45 pm |
Great post, this is what is missing it the manuals for VirtualBox…
Your “final thoughts” are well thougth and this has already be done:
http://www.die-rooter.de/ITworks/archives/4-VirtualBox-CloneVDI.html
March 17, 2009 at 1:48 am |
What a damn shame one can’t clone an entire virtual machine including snapshot hierarchy to another machine. Thanks for this howto. And Yes, the VirtualBox snapshot commands really are poorly named.
Love AsciiDoc! (Thats how I found this article) – perhaps I’ll try blogpost.py one day…
March 17, 2009 at 5:17 am |
Am I reading this correctly – the only way to back up a guest VM with snapshots in its “most recent” state is to merge them all (and therefore losing all the “old snapshots”?)
March 20, 2009 at 12:51 pm |
Very helpful article !
I copied a VM on the same host machine (Host: Linux 10.3, VirtualBox 2.0.6).
Log in as root, change to ‘/usr/bin’, and ‘VBoxManage’ will do the job as described above :-)
March 20, 2009 at 4:11 pm |
Thanks for posting this. I needed my snapshots to come along for the ride.
March 25, 2009 at 8:42 am |
Thx for this howto, very useful. Since you hitted well in the google-rank, the following addendum might be useful to others comming along:
Apparently the syntax of the VBoxManage clonevdi command has slightly changed.
I could run it from any ‘current working directory’ but I had to specify the *vdi files (both source and target) with their relative paths under the $HOME/.VirtualBox directory
So for my setup with HD files at $HOME/.VirtualBox/VDI, I had to use
VBoxManage clonevdi ./VDI/source.vdi ./VDI/target.vdi
to make the disk-clone
March 25, 2009 at 6:53 pm |
Thank you for the detailed description and instructions. However I feel some detail must be missing. After trying your instructions for the 3rd time, I am always left with the base-installation of my guest os (Fedora-10) just prior to making my first snapshot.
The snapshots are deleted and the xml references to them are removed. I restored from backups, modifying the xml to get it functioning and ran the vm to verify the restore worked.
I have become good at modifying the xml, and figure I can just write my own utility to migrate
an image to another host. However it would be good to not have to include the snapshots with my distribution (amongst local dev’s in our department). Here are some details I came across that the instructions above seem to have glossed over:
1) The last entry in the ‘Snapshots’ tab is always a “Current State” item, further this may be showing as “(changed)” or not.
2) If “changed”, then the instructions advise creating a new snapshot first. Doing so creates a new snapshot with the last entry as “Current State” without the “(changed)” flag.
3) At this point the instructions say to select the latest snapshot we want, and select “Discard Snapshot”, and this will be merged into the parent. However the latest is always the “Current State”. There is no “Discard Snapshot” option for the Current State entry, just “Revert to Current”, “Discard Snapshot and State” and “Take Snapshot”. If I select the actual snapshot, I can “Discard Snapshot”. So I do this.
4) Select “Discard Snapshot” from the snapshot parent of “Current State”. This takes a very long time, and I’m left with the previous snapshot and a “Current State (changed)” entry.
5) Now, do I create a new snapshot, since I have a changed “Current State”? It seems I could go in circles here, so I continue and select the now last snapshot (since I just discarded, or “merged” one). I select “Discard Snapshot”.
6) Will this include the “Current State (changed)” entry data? Not sure, but it takes a long time again to complete (my images and snapshots are between 6GB – 11GB in size, so I’m not surprised it takes a while – this is encouraging)
7) Now I am left with just a “Current State (changed)” entry, and no snapshots. But when I fire this up, it is just the base install, with no snapshot changes included. All my configurations are gone. Looking at the file-system, I notice that the “Snapshots” folder is now empty, and the “HardDisks” folder just has a single file dated from the time 3 weeks ago when I created the first disk, before taking my first snapshot.
What happened to my snapshots? It seems VBox took a long time to delete them and provide nothing else. There doesn’t seem to be much evidence of any merging of data/files taking place.
Conclusion:
Unless there is something I missed (I tried the above 3 times), it doesn’t seem that VBox can merge snapshots into the main HardDisk file. The only way I was able to migrate an image was to copy all snapshots and xml files to the new system and install them intact (with minor tweaks to the xml).
Please feel free to rip apart what I’ve done and expose any errors in my understanding. I just cannot believe that Sun would make such an excellent product (it runs great) without the ability to migrate the images with a degree of ease.
Well, then again it’s free software, and not as mature as VMWare – but for the price VBox is pretty amazing.
– Richard
3)
March 25, 2009 at 7:58 pm |
Well, what do you know?
While writing the above I was also in the midst of a final attempt. This time it appears to have worked and my HardDisk now is much larger and contains the sum of all snapshots.
I feel like an idiot, but hey that’s operational development for you.
I would only then add a single additional step if the instructions above fail:
1. Write a post explaining with excruciating detail everything you’ve done, make a fool of yourself, and post it before completing your final attempt. It will surely work this time.
Thanks guys,
– Richard
April 2, 2009 at 8:55 pm |
Cool, the same basic procedures work great on Mac OS X 10.5.6 with VirtualBox 2.1.4 for Mac.
Main difference is the files are located in:
\Library\VirtualBox\HardDisks\
and
\Library\VirtualBox\Machines\
Command line syntax is just the same except for the pathing. On the Mac you can just cd down into the HardDisks directory and run:
vboxmanage clonevdi “Ubuntu 8.04.vdi” “Ubuntu 8.04 clone.vdi”
And off you go. :)
April 7, 2009 at 2:56 pm |
Thank you very much!!!
First time that I understand it
April 19, 2009 at 3:00 pm |
Thanks for this. Stefan.
April 20, 2009 at 2:49 pm |
Thanks for the nice article.
What is strange is that I have the same Ubuntu image 8.04 :)
April 20, 2009 at 2:55 pm |
On MAC one may see this error: “Could not get the storage format of the hard disk”
Solution: It needs an absolute path. Relative goes to default disk image location
Credits: http://forums.virtualbox.org/viewtopic.php?f=8&t=15021
April 23, 2009 at 1:19 pm |
– Nice, Stuart. Thanks!!
April 28, 2009 at 1:59 pm |
Another minor correction. In your ‘Merge source snapshots’ section, you state in step 3 that the current state of the disk can be included in the merge by taking a snapshot. Step 4 then instructs the user to use Discard Snapshot on the most recent snapshot you want included in the target VM. However, if you do this on the snapshot created in step 3, it deletes the snapshot, but changes are not saved in the previous snapshot. Rather they are put back into the current state of the disk.
In this case, what you have to do is create a snapshot as per step 3, then delete the prior snapshot(s) to the one you have just created. The snapshot you are left with will then contain the current state of the disk.
May 12, 2009 at 2:58 am |
What a great post and instruction guide this is. Really well-done and composed. Explained everything clearly. Perfect. Thanks!
May 12, 2009 at 5:37 am |
Just one other word to the wise: Be sure you have enough disk space before you discard a snapshot, especially if it’s a 20Gb-type large snapshot file because you are going to need basically 2x the actual disk space of the update .vdi file. I found this out. My disk ran out of space during a snapshot discard operation. I was able to get around it by moving the snapshots and the .vdi file to an external USB harddrive and then creating soft links in their original locations and fortunately was able to restart the discard snapshot operation. It’s much slower over the USB but at least it will probably finish ok this time.
May 20, 2009 at 10:23 pm |
Thanks for your information!, but as i tried to clone a vdi, it didn’t work, so i googled and found out on that website: http://www.virtualbox.org/ticket/3888 that i need to include the complete path of the vdi files in order to get it cloned – so now it works!
Here is the full example:
——————————————————————————–
C:\Documents and Settings\srackham\.VirtualBox\VDI> “C:\Program
Files\Sun\xVM VirtualBox\VBoxManage.exe” clonevdi “C:\Documents and Settings\srackham\.VirtualBox\VDI\Ubuntu 8.04.vdi” “C:\Documents and Settings\srackham\.VirtualBox\VDI\Ubuntu 8.04 clone.vdi” VirtualBox Command Line Management Interface
Version 2.0.4 (C) 2005-2008 Sun Microsystems, Inc. All rights
reserved.
0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100%
C:\Documents and Settings\srackham\.VirtualBox\VDI>
——————————————————————————–
And for those who don’t know how to get into the path with the cmd:
Just type
cd C:\Users\Your Username\.VirtualBox\VDI
And then the your command, e.g.:
“C:\Program Files\Sun\xVM VirtualBox\VBoxManage.exe” clonevdi “C:\Documents and Settings\srackham\.VirtualBox\VDI\Ubuntu 8.04.vdi” “C:\Documents and Settings\srackham\.VirtualBox\VDI\Ubuntu 8.04 clone.vdi”
Good luck!
May 20, 2009 at 10:25 pm |
without the extra wide spaces in between, of course.
sorry
May 24, 2009 at 5:26 am |
Thank you, I just did a barbaric copy paste of the virtual disc image file, but when I saw I could not import the old virtual machine configuration file i was lost. Thanks for poiting out that there is no easy way to use the old file and that we have to recreate a VM poiting to the same disc image file. Not very friendly, but quite effective.
May 28, 2009 at 2:15 pm |
A valuable article for the explanation of merging snapshots. You are right about VirtualBox terminology being confusing, and the documentation is no help at all. I’d almost certainly have lost information if I’d gone ahead without having read this article. Thanks.
June 11, 2009 at 11:55 pm |
very handy, thanks
June 13, 2009 at 2:17 am |
Very nice write up.
June 17, 2009 at 11:44 pm |
You will run into a network related issue in cloned images on booting
them.
eth0 in the cloned instances will not start due to this error.
SIOCSIFADDR No such device eth0 error while getting interface flags
(I got to that error by running $sudo ifup -a )
This forum here has a good description of the problem and a solution
http://ubuntuforums.org/showthread.php?t=255018
If the steps in that forum do not work, simply remove eth0 mappings and change eth1 to eth0. Restart the server to see the changes take effect.
June 24, 2009 at 11:56 am |
Right, so cloning a VM is cloning the hard drive. What if you want to clone the VM settings itself (except disks, uuid, and name)? Here:
June 24, 2009 at 11:58 am |
Right, so cloning a VM is cloning the hard drive. What if you want to clone the VM settings itself (except disks, uuid, and name)? Here:
June 26, 2009 at 3:03 am |
Thank you very much for this blog post. I was able to clone my virtual machine within minutes of reading this well-written post.
July 2, 2009 at 8:37 am |
Thanks very simple and useful explanation, works fine!
July 3, 2009 at 1:13 am |
It’s working for linux too..
VBoxManage clonevdi XP1.vdi XP2.vdi
thank you ^^
July 4, 2009 at 11:04 pm |
Great!!
:)
July 7, 2009 at 5:12 pm |
Wow great stuff and easy to follow. I have noticed if I have a VM that is less than 4GB and will fit on dvd or fat32 drive it goes very well but if > 4GB and therefore NTFS used the process becomes a lot more envolved. Does VirtualBox use Win’s sids. Thanks.
July 7, 2009 at 6:59 pm |
Thanks for this post. It cleared up a lot of things.
July 10, 2009 at 2:39 pm |
I’ve created a video walking through this process (on a Mac, but the same process would work on a PC, just using different file locations) here:
http://joshprowse.com/virtualbox-how-to-clone-copyduplicate-a-virtu
Hope this helps somebody!
July 13, 2009 at 9:00 am |
Thanks , it was ussefull for me. Thanks again.
July 20, 2009 at 12:50 pm |
Many thanks. Indeed this is one of the most important operations that a user would want to do – it is easy to break VM so it is best to have copies available.
Your explanation is excellent.
Here’s an interesting error I was getting… I kept getting an error with the clone command.
“Cannot register the hard disk ….. because a hard disk …. ….. already exists in the media registry ….”
Mac OS X Host, XP Guest.
The reason the command was failing – yet giving me an “already exists” error – was that I had not used the correct uppercase/lowercase spelling of the master I was copying! I had spelt the filename all in lowercase in the command.
Go figure as to why you get an error saying file already exists instead of file not found!
Cheers
–mark
July 22, 2009 at 1:23 am |
I realise this is an old post… but the command (at least for v3) is now:
VBoxManage clonehd [options]
..which does the same as clonevdi, according to the doco.
Worth noting too that the output file will be placed in the default vbox HD folder.
July 28, 2009 at 2:47 pm |
Many thanks for this amazing guide to the muddled land of snapshots.
I don’t understand why this is explained as “When you create a snapshot, changes to the file system accumulate in the current snapshot file, older snapshot files and disk image files are effectively read-only.” Wouldn’t it be simpler to say that the snap shot file is the OLD .dvi? Making a snap shot creates a new .dvi which is the current state (or some differential information needed to make the current state). Or am I missing something?
July 29, 2009 at 9:51 pm |
This was very helpful. Thank you!!!
August 5, 2009 at 5:10 pm |
Great tips. You’re right, there is a lot of confusion on how to copy an image with latest snapshot to another PC. These steps by far is the easiest way I’ve seen. Thanks for the info.
August 6, 2009 at 3:39 pm |
Extremly helpful. Your documentation pulled my away from thin ice.
(The directory from where the VBoxManage command has to be invoked changed from VDI to HardDisks in Version 3.0.2).
Cheers
August 12, 2009 at 2:23 pm |
Hello Stuart,
Thanks for all the information!
I’ve found an easier way. Here in my VirtualBox3 I have the following menus:
File > Export Appliance
File > Import Appliance
Which apparently did the same job, with no need to merge the snapshots first neither creating a new virtual machine by hand. It was all automatically done by exporting and then importing again.
The only (minor) issue I’ve had was having to readd the shared folders.
Oh, and the snapshots are lost on the clone. They’re untouched on the original.
August 20, 2009 at 4:33 am |
Thank you for sharing this information with us. I was able to clone my Windows XP image successfully following these instructions.
August 21, 2009 at 4:26 am |
Thanks for this. It’s very clear and helpful.
September 4, 2009 at 4:00 pm |
Thanks for writing this guide! It’s not that tough once you get the process down, and you’ve helped me in doing that very much with this post. Thank you!
Ryan
September 4, 2009 at 7:53 pm |
The Version 3.0.4 of VirtualBox has a ‘ clonehd ‘ command.
Thanks for the tip. It saved me a lot of time. :D
[ ] ‘ s
September 5, 2009 at 9:49 pm |
Adding onto what I learned from this article. I would like to add my experience. I use VirtualBox on Centos 5.3 and manage my virtual machines mith VBoxManage.
Here is how I can use snapshots.
Machine name q3
q3 has a one harddisk at:
/root/.VirtualBox/HardDisks/q3.vdi
q3 has a snapshot directory at:
/root/.VirtualBox/Machines/Snapshots/
Initialy /root/.VirtualBox/HardDisks/q3.vdi is my live drive and is updated constantly while q3 is running. The snapshot directory is empty.
You might think of /root/.VirtualBox/HardDisks/q3.vdi as the ‘state’ of your drive.
Now I make a snapshot:
# VBoxManage snapshot take mysnapshot
Now /root/.VirtualBox/HardDisks/q3.vdi is effectively frozen and you will see that the time stamp will never change.
I now have a file in:
/root/.VirtualBox/Machines/Snapshots/{0982.3123.894.72.32}.vdi
the name is random (I think) generated by the system, but VBoxManage knows that this snapshot is named mysnapshot.
At this point I think it worth thinking about this…
/root/.VirtualBox/Machines/Snapshots/{0982.3123.894.72.32}.vdi
is not your snapshot it is your live ‘state’ file, open and being updated by the running machine and…
/root/.VirtualBox/HardDisks/q3.vdi
is your readonly snapshot!
Try:
# VBoxManage showvminfo q3
and you will see that it reports that you have a snapshot and that it’s name is mysnapshot.
Now make another snapshot:
# VBoxManage snapshot take mysnapshot
and again…
# VBoxManage snapshot take mysnapshot
Now there will be three files in the snapshot directory, two frozen in time and the latest ‘state’ file.
Now what I know from my few and limited tests is that you can merge your last snapshot into your second last snapshot and not lose any data.
You would do this if you thought you had too many snapshot files and wanted to clean up…
# VBoxManage snapshot q3 discard mysnapshot
now you have only two files in snapshots and one of them is the live state file
# VBoxManage snapshot q3 discard mysnapshot
now you have only one file in snapshots and it is the live state file.
# VBoxManage snapshot q3 discard mysnapshot
now you no files in snapshots and
/root/.VirtualBox/HardDisks/q3.vdi
is once again live, with all the snapshots merged back into it and nothing lost.
Summary:
# VBoxManage snapshot take mysnapshot
# VBoxManage showvminfo q3
# VBoxManage snapshot q3 discard mysnapshot
September 8, 2009 at 12:59 pm |
Thanks alot. I’ve used this posting twice with success. It is very helpful and clearly written.
September 12, 2009 at 12:56 am |
Awesome, thanks! Took a lot of hunting to find this, but it worked perfectly.
September 25, 2009 at 4:18 am |
Thanks for the tips! I needed to know how to clone my VMs and this helped a ton!
October 6, 2009 at 1:32 pm |
If this doesn’t work, be sure to put the new vdi in a different folder, and use absolute paths for both source and target vdi.
October 12, 2009 at 11:15 am |
Thanks for this. It seems a little strange that there is no UI support for cloning images, since I would think that is a common operation. But thanks to you guide, I managed to get through it just fine anyway :)
October 12, 2009 at 2:15 pm |
Hi Stuart,
Excellent overview – I was looking for something exactly like this. Has helped me a lot. Thanks.
BR//Bart
October 23, 2009 at 12:19 pm |
Clean Clone of VirtualBox VM:
VBoxManage export vmname -o vmname.ovf
VBoxManage import vmname.ovf
Greetings,
Phillip Hagedorn
October 30, 2009 at 4:39 am |
Nice notes! Have you updated this?
October 31, 2009 at 8:10 am |
Thanks, the article helped me a lot
November 1, 2009 at 9:48 pm |
These are terrific instructions, thank you.
November 2, 2009 at 8:08 pm |
Current (as of Nov 2009) VirtualBox manual recommends using clonehd instead of clonevdi.
clonevdi is however maintained for backward compatibility.
VBoxManage clonehd |
[–format VDI|VMDK|VHD|RAW|]
[–variant Standard,Fixed,Split2G,Stream,ESX]
[–type normal|writethrough|immutable]
[–remember] [–existing]
November 4, 2009 at 1:55 am |
Thanks for posting this! I’ve been playing with VirtualBox for the past month and couldn’t figure out how to keep a pristine master of my development workstation. Now I know!
May 16, 2010 at 2:11 am |
BTW: Cloning a Windows 7 VM requires a second license because the machine id changes. I guess we’ll have to resort to the original plan of copying the VDI manually and running only one instance at a time.
November 7, 2009 at 11:12 pm |
Now there’s a much easier way to copy a machine, based on the OVF support.
Just export the virtual machine as OVF using the “File/Export Appliance” menu item, then import back the generated OVF file using “File/Import Appliance” and you can make as much copies as you want.
You may erase the OVF file after you end up having all the clones you need..
The drawback is that it takes a bit more disk space than the instructions found above, but it’s much smoother from the user’s perspective.
Cristi
November 26, 2009 at 4:58 pm |
Thank you very much for this article. It helps me a lot. (and I agree virtualbox snapshot commands should be completely renamed)
December 2, 2009 at 8:25 am |
I want to do this using command line – bo GUI, since I amm running vbox in Ubuntu Server just like a Virtual Server. Now I want another similar virtual machine within the same server, could you please let me know the steps?
Thanks
December 2, 2009 at 4:08 pm |
Thanks!
To make it explicit, the command under Linux to clone is:
VBoxManage clonevdi source.vdi destination.vdi
December 4, 2009 at 10:13 am |
It becomes even more problemmatic if you have dropped additional hard disks in intermediate snapshots. :-((
December 4, 2009 at 10:41 am |
The scenario is that I had dropped a disk in an intermediate snapshot which it then wouldn’t discard. However discarding the snapshots above AND below the one which it won’t drop INCLUDING the original .vdi , has the effect of merging the snapshot it won’t drop back into the original .vdi. Surprisingly it even still seems to work.
December 6, 2009 at 10:58 pm |
My friend it doesn’t work to clone when i follow the step under “Creating a clone on the same host machine” above
i got follow message:
H:\VirtualBox\5 linux>VBoxManage clonevdi “Feodora11.vdi” “Fedora11 clone.vdi”
VirtualBox Command Line Management Interface Version 3.0.12
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.
ERROR: Cannot register the hard disk ‘H:\VirtualBox\5 linux\Feodora11.vdi’ with UUID {43a0b87f-d00d-410b-b798-19e90f02cb60} because a hard disk ‘H:\VirtualBox\5 linux\Feo
dora11.vdi’ with UUID {43a0b87f-d00d-410b-b798-19e90f02cb60} already exists in the media registry (‘C:\Users\Admin\.VirtualBox\VirtualBox.xml’)
Details: code E_INVALIDARG (0x80070057), component VirtualBox, interface IVirtualBox, callee IUnknown
Context: “OpenHardDisk(Bstr(szFilenameAbs), AccessMode_ReadWrite, false, Bstr(“”), false, Bstr(“”), srcDisk.asOutParam())” at line 624 of file VBoxManageDisk.cpp
H:\VirtualBox\5 linux>
what could got wrong?
December 6, 2009 at 11:03 pm |
ah forget it… i solve it
December 6, 2009 at 11:04 pm |
For other that has the same problem
always remember:
Write:
H:\VirtualBox\5 linux>VBoxManage clonevdi “H:\VirtualBox\5 linux\Feodora11.vdi” “H:\VirtualBox\5 linux\Fedora11 clone.vdi”
that will have the syntax:
VBoxManage clonevdi “path\file.vdi” “path2\file2.vdi”
it was the path that was missing before!
cheers
December 10, 2009 at 10:14 pm |
Is it possible to also copy the BIOS DMI info when cloning a machine?
The problem I come to is that when I clone a windows installation, it requires re-activation even though it’s on the same host.
December 17, 2009 at 1:10 am |
Thank you!
December 17, 2009 at 9:54 am |
You are a genius :-)
Thank you so much for this post, it helped me to work with VirtualBox.
bye
December 25, 2009 at 8:40 am |
Thank you, that was a clear and useful article.
December 31, 2009 at 5:40 pm |
Many, many, many thanks!
January 4, 2010 at 4:55 pm |
Thanks, very good written and useful (even for a Mac user). Mac note: Open the terminal and run VBoxManage clonevdi “old name.vdi” “copy name.vdi”. You don’t need to change directory if you use the default location for your virtual harddisks.
January 6, 2010 at 7:19 pm |
Thanks for info… I keep going back to this post every time I need to clone a VirtualBox image
January 7, 2010 at 7:53 pm |
Thanks, that was really helpful! By the way, for Mac OS X, the path the VDI files is /Users//Library/VirtualBox/HardDisks/
January 11, 2010 at 1:05 am |
Thanks for the tutorial! It was a big help.
I had one minor issue, and I’ll note it here just in case it helps someone else. For some weird reason when I typed this command…
C:\Documents and Settings\srackham\.VirtualBox\VDI> “C:\Program
Files\Sun\xVM VirtualBox\VBoxManage.exe” clonevdi “XXXX.vdi”
“XXXX clone.vdi”
…I got an error: “Cannot register the hard disk XXXX with UUID YYYY because a hard disk XXXX with UUID YYYY already exists in the media registry blah blah blah…”
However, based on some internet sleuthing, it seems that virtualbox may now require the full path to the .vdi files. When I used full paths, the error went away.
May 21, 2010 at 12:50 am |
yes, I agree with you :)
thank you for your comment here since i also have the same problem with you to clone the vdi.
January 23, 2010 at 4:43 am |
Thank you! This is a great post. I just linked to it off my post on how I did it the hard way (it’s at http://bit.ly/7OZMT7). I spent a good two hours editing everything and figuring it all out. The Amazing thing is that it works! I agree that it would be better to just use the tools it comes with.
January 26, 2010 at 8:22 pm |
An alternative, since VirtualBox 2.2, is to export the VM to the OVF format, and reimport it. It takes some time and disk space, but at least you don’t have to lose your snapshots on the original VM.
February 6, 2010 at 11:10 pm |
This was helpful, but I had one small problem at the end.
I was cloning the hard drive of a windows box, so I wouldn’t have to spend countless hours patching. When I said to use the existing, the new drive wasn’t there. I had to use the Add button to add the drive.
Version I’m using is 3.1.2 on Debian linux (non-ose).
February 16, 2010 at 11:34 pm |
Hi Stuart,
Thank you very much for providing such a detailed and comprehensible overview. This is extremely helpful. Much appreciated.
Best regards,
Mafat
March 2, 2010 at 7:34 am |
Thanks for the note .Very well written and very help full .As you have rightly pointed out the sun docs leave a lot to be desired but the product never the less is very good .
March 4, 2010 at 1:50 pm |
Thanks for this, I was also confused by the oddly used term ‘discard’.
March 8, 2010 at 1:21 pm |
Hi,
This is really to the point explaination and perfect.
regards,
Vinny
March 20, 2010 at 6:44 am |
Actually, the editing of the XML files is trivial. To create exact copy of a virtual machine, first create new VM using the GUI. Then find the newly created virtual machine, open the XML file, delete everything except the UUID (ie everything except the first 3 or so lines), then copy in the info from the XML file for the virtual machine you want to clone.
Of course, clone the VDI image as described in the article, detach the original one in the new VM, and attach the cloned one….
March 22, 2010 at 11:37 pm |
Rad! Very handy, I especially like your descriptions of their use of “discard” I would not have anticipated them behaving that way. And hell I didn’t even realized the clonevdi command existed. Thanks.
March 29, 2010 at 5:49 am |
This page is exactly what I was looking for. Thank you for sharing the information. I believe things may have been changed a bit since this had been posted.
After adding a path in the command prompt, when in the folder location “C:\Users\\.VirtualBox\HardDisk\” the comand that was needed to clone the hard drive on my system was:
VBoxManage clonehd “.vdi” “.vdi”
April 9, 2010 at 10:45 am |
Top notch work! VirtualBox 3.1.6 on Ubuntu 9.10 now shows “discard” as “delete”, but it appears to do exactly the same as you describe.
You are right, it really should say “Merge into previous snapshot” or something similar, as you are not deleting or discarding any data, just the ability to revert to the snapshot before the one you are about to “Delete”
April 10, 2010 at 8:37 am |
Negasuki has simplified it. Thanks.
For Windows XP I simply created Clone.bat as follows. “C:\Program Files\Sun\VirtualBox\VBoxManage.exe” clonehd “OldPath\OldName.vdi” “NewPath\NewName.vdi” It works like a charm.
Just add the new drive with File/Virtual Media Manager/Add and apply it to a new or existing machine.
And the command “C:\Program Files\Sun\VirtualBox\VBoxManage.exe” internalcommands sethduuid “Path\CopiedFile.vdi” works on a copied and renamed HD files
April 20, 2010 at 10:41 am |
Cheers mate, worked like a charm!
April 28, 2010 at 11:51 am |
Thanks, definitely very useful and only found in this blog after navigate for hours !!
May 8, 2010 at 9:46 am |
Thanks Stuart, wish all other tuts had this accurate explanation.
May 8, 2010 at 5:15 pm |
You do not actually need to do all the merges to clone the latest (or any) snapshot, as “VBoxManage clonehd” allows you to provide a snapshot identifier as an alternative to a VDI filename, and this merges all the changes up to the chosen snapshot into the output file.
You need to get the snapshot id for the drive first, but this is not difficult.
The following works from the VBox GUI, but there would also be a commandline way to do it:
1. Select the VM, and click on “snapshots”
2. Note the name/description of the snapshot you want to clone (if you want to clone “current state” you will need to snapshot this state first, and give it a name)
3. Go to the “VirtualMediaManager” and expand the entire tree of the drive you want to clone
4. Find the diff file relating to the snapshot you want to clone –> As you select each “child” or diff-file, the bottom of the window will display the full filepath/location, and also “Attached to: ()
5. Once found, you are able to select and copy the location. It will be something like “.VirtualBox/Machines/MyVM/Snapshots/{297a42c0-236c-474b-af3c-6393b31518ef}.vdi”
6. Paste the location into a text editor and remove everything except the ID of the diff file, eg “297a42c0-236c-474b-af3c-6393b31518ef” (note, no braces or “.vdi” – just the ID)
7. You can then use this ID to clone the snapshot, using CLONEHD (not clonevdi), eg “VBoxManage clonehd 297a42c0-236c-474b-af3c-6393b31518ef /home/myClonedVHD.vdi”
And that’s it – no need to merge all the snapshots – clonehd will do that for you for the new vdi, but leave the original chain/tree of snapshots untouched!
May 20, 2010 at 2:48 pm |
Worked great, thanks a ton!
May 22, 2010 at 7:32 pm |
It seems that if the hard disks are in vbox default directory (like ~/.Virtualbox/HardDisk/ or someting) one can do just
$ VBoxManage clonevdi src.vdi dst.vdi
but if it is somewhere else, one needs to do
$ VBoxManager clonevdi UUID dst.vdi
otherwise it will result in message like:
Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBox, interface IVirtualBox, callee nsISupports
Context: “OpenHardDisk(Bstr(szFilenameAbs), AccessMode_ReadWrite, false, Bstr(“”), false, Bstr(“”), srcDisk.asOutParam())” at line 624 of file VBoxManageDisk.cpp
June 21, 2010 at 1:07 pm |
Hello all,
The post itself didn’t help me since I already found the way to clone in some docs, but user’s comments did – after getting the same “Cannot register the hard disk” error, i tried entering with full path and it worked! Thanks for that!
But, now I see that this actually wasn’t what I was looking for – I needed a way to copy existing small VDI file to BIGGER VDI file.
Thing was I first made a 4Gig disk, which became small very soon and I wanted to move the complete system that to larger virtual disk without reinstalling it from the beginning.
Any ideas on that one?
June 21, 2010 at 10:17 pm |
@Amos – as I see it, you have two options.
The first would be to simply add a new disk to the VM, and not actually increase the disk size – like adding a “D Drive”, or you could also mount the new drive under a mountpoint so it appeared to be the same drive in terms of your folder structure.
The second would be to create the new bigger VDI, and mount both the old and new VDIs with an Ubuntu LiveCD (or similar) and use
cp -r /media/oldvm_mount_point/* /media/newvm_mount_point
to copy the entire contents of the older drive to the new one. This is a little invoved – Windows may well fail to boot from the new drive, and if so, there are a few steps you need to take to get it working. I have a lengthy email with instructions on fixing the boot issues – I’ll quote a relevant section here, but if this isn’t enough to get you going, I’ll post it up on my blog:
Quote:
25) Shutdown the Win VM, and Reattach the drive to Ubuntu VM (note that if you took a snapshot, you may need to select the “differencing” disk, rather than the main VDI). Mount and edit boot.ini – do this with “sudo gedit /media//boot.ini” rather than VIM, as gedit respects the CRLF. Probably best to do a backup first as well. Also backup your changes to ubuntu desktop, in case you lose them due to “differencing” disks, and need to redo it. Shut down Ubuntu VM.
June 28, 2010 at 7:50 pm |
Thanks Stuart
I’m feeling lucky that I met with your article.
Yesterday I switched from vmware to VirtualBox due to some issues with 64 bit ubuntu 10.04(Lucid). I was wondering how to clone my new installations, else it would have been a havoc for me to create a new network for every machines. And I thank God, I reached your article.
Thanks dear again. Keep up with your spirits. :)
June 29, 2010 at 5:06 pm |
This is a useful post, but my experience was rather different: perhaps I’m just being slow, though.
Your instructions seem to indicate that one needs to delete snapshots starting with the newest and working `backwards’ in time. I found that this just had the effect of removing these snapshots as if I had never taken them. Instead I needed to merge forwards in time, until I reached the snapshot I wanted to clone as my base. I could then use clonehd to make a copy of this base .vdi file, which contained my chosen snapshot.
Is this anyone else’s experience? What am I missing in the above instructions?!
June 30, 2010 at 8:23 am |
Liz,
See my reply dated May 8. You *do not need to merge any snapshots* to clone them if you use clonehd and the correct identifier for the snapshot that you want.
It would be good if Stuart could put the info from my post into his main article to avoid all confusion. I too found his explanation to be invaluable, however I also found bits and pieces on other sites, and bringing them all together, worked out how to clone without merging, which I think for most people would be less confusing – not to mention the fact that some people may not want to merge (as you lose your snapshots).
My point is, that it *is possible* to clone from any given snapshot without merging, and that it it not difficult. Stuart’s article gives the impression that this is not possible, and it would be great if he could rectify this, as obviously there are a lot of people who want/need this info. Yes, this is a complaint ;-) …. but I’ll reiterate that I still found this article invaluable, and must thank Stuart for it!
July 31, 2010 at 11:37 am |
Most folks will just want:-
VBoxManage clonehd ORIGINAL.vdi CLONE.vdi
October 20, 2010 at 6:40 am |
guvnr u are 100% write.. thanks.
November 16, 2010 at 10:27 am
Thanks RALPHIN, for making me notice what gunvr said.
August 10, 2010 at 12:17 pm |
hi
me take the snapshots at two different time/configuration intervals. now I want to revert back to 1st snapshot. but cannot revert.
the revert back option dimms.
Kindly help me to sort out this problem.
Rashid
August 13, 2010 at 6:58 pm |
After cloning the hard disk, I had to attach it using “Virtual media manager” to get the disk listed. I am Using OracleVM Version 3.2.8.r64453 on fedora 13
August 20, 2010 at 6:04 pm |
Thanks you save me HOURS of time!!!!
September 7, 2010 at 2:41 pm |
Hi!
I’m starting a blog about technology in portuguese and I wanted to use/translate this content. I’ll put a link directing and refering to your site. Can I use it?
Thanks in advance.
Alexandre
September 29, 2010 at 5:43 pm |
Well i found a different thing if you changed the serial of the real vdi then you can never delete it totally it is giving error.(If you prepare some snapshots)
So it is better to open a new folder and copy the vdi there and change the copy vdi so u can not crash the real one and your vpc.
September 30, 2010 at 9:52 am |
thank you very much Stuart.
This article help me a lot and I’ve save a lot of my time.
thanks again
October 2, 2010 at 4:23 am |
Well i wrote an app. for everyone to use it.I shared it for people to save time but it is not posted here writing “Your comment is awaiting moderation”.What is wrong it is not a spam or a virus or a keylogger or others.It is only opening cmd and get a copy of that file nothing more.
Anyhow ty for the blog i used how to change it but people need some fresh
and easy solutions never forget it byes.
October 11, 2010 at 3:40 pm |
Thanks, this walkthrough saved a lot of time!
October 16, 2010 at 12:10 pm |
Thanks for writing this guide. I couldn’t figure out why I could just copy a VDI! You just saved me another few hours of messing around with it!
October 28, 2010 at 6:43 pm |
Thanks for the great article, I was able to clone my Machine.
November 4, 2010 at 4:55 am |
You sir, are a good man.
This tutorial was SUCH a relief from the long-winded, angry forum threads that characterize much of the VirtualBox documation.
Thank you.
November 27, 2010 at 1:38 pm |
Thanks, works perfectly
December 23, 2010 at 12:36 am |
Awesome article, worked perfectly on Debian. Also, just FYI for anyone listening, the VDI directory in Debian is hidden by default at ~/.VirtualBox/VDI
January 7, 2011 at 11:17 pm |
Any help on doing this with VirtualBox v4 welcome. I’m trying to follow their Help instructions.
January 13, 2011 at 6:30 pm |
It is indeed simple. Thanks
February 24, 2011 at 11:21 am |
On a Mac, execute this command in Terminal (adjust paths to match your environment)
/Applications/VirtualBox.app/Contents/MacOS/VBoxManage clonevdi /path/to/your/original.vdi /path/to/your/copied.vdi
March 5, 2011 at 7:15 pm |
My PC came pre-loaded w/Vista. Since I was never given the install discs, how may I define Vista as the guest OS to Virtual Box without these discs?
Thanks,
Dan
March 6, 2011 at 3:34 pm |
This worked fine, no issues
March 17, 2011 at 4:27 pm |
Thanks.
March 31, 2011 at 10:14 pm |
Hi,
I found this article very helpful! Thanks for posting.
May 24, 2011 at 8:24 am |
good article Stuart! Thanks to you I have been able to avoid wasting my times, the tuto works really fine!
May 25, 2011 at 1:36 am |
Since Virtual Box requires an OS and my PC came with VISTA already preinstalled (so I do not own the MS original VISTA install disk) how do I tell Virtual Box that I am using Vista?
June 10, 2011 at 7:35 am |
how hard is it to add a button for cloning :S
June 14, 2011 at 6:36 am |
Hi,
Great article.
I have query that If I cloned the vdi file its again asking for Windows activation. I think because of changing UUID. Suppose If I copying the vdi file do I need to activate the Windows license?
June 24, 2011 at 4:31 pm |
A good writeup on using the newer clonehd command is here:
http://forums.virtualbox.org/viewtopic.php?f=1&t=791#p106206
As others above said, this will allow you to clone a snapshotted HD image without first flattening it. The result will be flattened, but the original image is un-changed.
Ex:
+-Installed WinXP (snap1)
+-Did some updates (snap2)
+-Current State
With VBoxManage clonehd you can clone snap2 or even “current state” and get NewImage.vdi, without having to merge and lose your snapshots in the original VM!
September 1, 2011 at 10:50 am |
Thanks alot for this guide, really helped me alot!
September 7, 2011 at 11:29 am |
Hi,
with version 4.1.0 there is a CLONE button!!!
I had to move the vdi’s from C: to D: because of the space I needed.
– In File – Preferences I changed the Default Machine Folder to a folder on D:
– within the GUI I selected a machine and pushed the clone button
– after cloning all the machines I deleted the original ones.
Very simple!
September 24, 2011 at 6:25 am |
nice blog..
can you add my site to your blogroll….
:)
September 28, 2011 at 7:44 pm |
Hi, I tried using a cloned image but this came up
E_INVALIDARG (0x80070057)
and something with the UUID, what can I do to solve this problem
Thanks.
November 17, 2011 at 1:19 pm |
Excellent article Stuart. It’s very useful especially with the inline notes.
Thanks
November 23, 2011 at 4:11 pm |
Excellent write up.
I’m using VB 4.1.2 and cloned a VM. I selected the Full option. The result was a new VDI without any dependency on any other VDI. Now I haven’t started this clone up yet bit this would imply that all the VDI’s got collapsed into a single disk including the base Multi-attach VDI.
Other than the name changes doesn’t this reduce your procedure to a single step?
January 24, 2012 at 6:29 pm |
Thanks buddy.. good instructions.. tested and worked fine.
January 30, 2012 at 12:58 pm |
Thank you Stuart! Just found out that simply copying a VM — which works with VMware WS flawlessly — doesn’t work with VBox and even broke my development VM :(. Spent hours today repairing it, now it seems to work again. The UUID stuff is really restrictive :(.
February 6, 2012 at 4:20 pm |
[…] found a tutorial here describing the process. Answered by […]
March 13, 2012 at 8:51 pm |
If you just want to MOVE your VMs to a different location, I found this topic very useful:
https://forums.virtualbox.org/viewtopic.php?f=1&t=48258#p219285
Just followed it and it’s working fine. All snapshots are preserved.
July 28, 2012 at 9:51 pm |
thanks this helped so much! be sure however, that you are already in the folder where your original .vdi is in the command prompt before you run the code.
September 21, 2012 at 9:33 pm |
Cloning now seems to be natively built-in; for more info see http://www.techrepublic.com/blog/itdojo/clone-and-move-virtual-machines-in-virtualbox/3305
December 6, 2012 at 10:32 pm |
Howdy! This post couldn’t be written any better! Reading this post reminds me of my previous room mate! He always kept chatting about this. I will forward this post to him. Fairly certain he will have a good read. Many thanks for sharing!
February 18, 2019 at 9:29 pm |
Couldn’t find my Q thru search, but: Why do so many continue to ignore the reality regarding failures, in trying to create VMs using .vhd of Windows OS installed on a different physical machine? The majority use OEM installations that are locked to the original computer, and Msoft made it impossible to simply migrate to other units, as that subverts their licensing structure. You can generally only put a new install onto a VM, or create a VM onto its same original machine, either under the same, or another new OS; i.e. a Win 7/10 VM under Ubuntu, where the .vhd was taken from the Win7/10 running, saved/backed up elsewhere, then a clean Ubuntu was installed on that machine; finally, a new VM was built up from the image of the original drive, which should work fine as it is still seeing/seen as on the correct original hardware. This fundamental issue is so pervasive, it should be emblazoned in ALL CAPS at the top of every troubleshooting page devoted to fixing Virtual machine issues. And since XP there simply is no way to trick or bypass the integral anti-piracy code that rules over these failed VMs.