how to make a copy of .VDI image?

This is for discussing general topics about how to use VirtualBox.
Post Reply
wesley
Posts: 8
Joined: 28. Jun 2007, 20:11

how to make a copy of .VDI image?

Post by wesley »

hi guys

I've created a single XP VM, i would like to make another 2 XP's so i can hook them up networking. So how can i make a copy of first XP VM for 2nd and 3rd XP VM?

with vmware workstation/server, we can do this.

i've tried many ways but keep get errors when booting up the second XP VM (copied from first XP VM)

using virtualbox 1.4

thanks
nailbnny
Posts: 1
Joined: 29. Jun 2007, 05:50

Post by nailbnny »

I've had success with copying the .vdi harddisk image with the command VBoxManage clonevdi ImageYouWantToCopy.vdi DestinationImage.vdi. Then just make a new VM that uses the new .vdi. It's a bit cumbersome, but it seems to work fine.
loan
Posts: 3
Joined: 13. Jul 2007, 11:50
Location: Switzerland

Post by loan »

Hi

clonevdi works only on the base vdi. Snapshots would be ignored with clonevdi. The only way is to merge all snapshots and then clone the single base vdi.

Check this post for more http://forums.virtualbox.org/viewtopic.php?t=791

regeards
Andre
aghamemnun
Posts: 13
Joined: 17. Jul 2007, 17:58

GUI

Post by aghamemnun »

I think the easies way to do it is via the GUI of VirtualBox. The VM to be copied has to be stopped.
I am using the German version, so I don't know how theEnglish menu reads. Anyway, I will try. In the menu, go on File > VM Drive Manager.
Select the virtual drive to be copied and klick "Release" (this is absolutely crucial!!!). The -vdi file is now detached from the VM! The disk Then make a copy of the .vdi file in a different directory.
Now, reattach the .vdi to its old VM: Close the Manager, and in the main window chose the VM, klick on "Change" (the button with the yellow toothed wheel). In the left part of the now opening preferences window, klick on "Hard drives", activate "Primary Master" and select the virtual HD in the drop down menu.

And then, how to attach the copy of the virtual HD you made to a different VM? Move the copied .vdi file to the directory where you want to have it. Then establish a new VM on any computer. In the wizard, choose the .vdi file as virtual HD for this VM. When you start the VM for the first time, you will be asked where the HD or disk image resists. Now, just klick on "Cancel". The VM will now start from the .vdi file attached.

Important: Any .vdi file can only be attached to one VM. So, if you want to make that .vdi file available to different VMs, you first have to make as many copies of the RELEASED .vdi file as you need and then attach each of them to its VM.
mhotze
Posts: 2
Joined: 24. Feb 2008, 11:24

Post by mhotze »

From the previous reply, making a copy works by releasing it, but adding this new copy to the virtualdiskmanager doesn't. It compes up with the error message:
"A hard disk with UUID {73d3fde6-8406-4e48-f29e-f0e927444f1a} or with the same properties ('/media/sda4/NewHardDisk2.vdi') is already registered."

It looks like the vdi image needs to have another UUID in order to work. Any other ideas? I would like to make a new virtual machine by just copying an existing one without having to re-install from a boot-cd.
mhotze
Posts: 2
Joined: 24. Feb 2008, 11:24

Post by mhotze »

Suggestion from nailbnny above works though. Follow these steps:

1) Shut down the virtual machine you would like to copy
2) In File > Virtualdiskmanager, select the virtual machine disk image you would like to copy, and press the Release button
3) In a terminal window, issue following command (see virtualbox user manual):
vboxmanage clonevdi /directory/image1.vdi /directory/image2.vdi
4) In File > Virtualdiskmanager, add the new disk image you've created in step 3.
5) In the main virtualbox window, press the New button to create a new virtual machine, and link it to the new disk image you've created.
dkleinm
Posts: 1
Joined: 20. Oct 2009, 05:31
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu 9.04

Re: how to make a copy of .VDI image?

Post by dkleinm »

I have version 3.0.8 and used Mhotze's method with the following command syntax on windows:

C:\Documents and Settings\.VirtualBox\HardDisks>"C:\Program Files\Sun\VirtualBox\VBoxManage.exe" clonehd ubuntu-1.vdi ubuntu-2.vdi --format VDI
VirtualBox Command Line Management Interface Version 3.0.8
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: 8b674cd8-77f7-4557-a319-f6bbac3216d
markc369
Posts: 1
Joined: 20. Oct 2009, 06:43
Primary OS: MS Windows Vista
VBox Version: OSE other
Guest OSses: xp

Re: how to make a copy of .VDI image?

Post by markc369 »

I also came up against this problem, but instead of using the clone tool, I just do a standard copy of the image (.vdi) and then change the UUID:

Code: Select all

F:\VirtualBox Images>"C:\Program Files\Sun\VirtualBox\VBoxManage.exe" internalcommands sethduuid HdImageName.vdi
This seems to work fine for me and is a little quicker than waiting for the whole thing to clone.

Hope that helps.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: how to make a copy of .VDI image?

Post by mpack »

In all modesty, anybody with a need to clone VDIs on a Windows host these days really ought to be using my CloneVDI tool. It's as fast as any other method, at least as reliable, is much easier to use, and offers options for things it can do while copying, such as optimize to improve performance and compact to save space. It also works under Wine on Linux hosts.
rogerdpack
Posts: 85
Joined: 31. Oct 2008, 13:00

Re: how to make a copy of .VDI image?

Post by rogerdpack »

markc369 wrote:

Code: Select all

F:\VirtualBox Images>"C:\Program Files\Sun\VirtualBox\VBoxManage.exe" internalcommands sethduuid HdImageName.vdi
This seems to work fine for me and is a little quicker than waiting for the whole thing to clone.
That did the trick.

On windows you can use the fastcopy program to create the copy fairly more quickly than just an explorer drag and drop. Then run the above command and the drives will become mountable.

The GUI mentioned above looks nice, too.

C:\Documents and Settings\packrd\.VirtualBox>"C:\Program Files\Sun\VirtualBox\VBoxManage.exe" internalcommands sethduuid UbuntuFreeSpaceCopy.vdi
VirtualBox Command Line Management Interface Version 3.0.8
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

UUID changed to: bd97b69a-a38e-4088-bad4-c6cfcc79065a
fever84
Posts: 2
Joined: 13. Jul 2010, 02:12
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Windows

Re: how to make a copy of .VDI image?

Post by fever84 »

I agree the clone tool is by far the easiest way as my vbox had a space in the name so it wouldnt work with the cmd line

http://forums.virtualbox.org/viewtopic.php?f=6&t=22422 :)
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: how to make a copy of .VDI image?

Post by mpack »

Well, I'm glad you found my CloneVDI tool useful, but readers should note that wrapping the text in quotes "like so" is how you handle spaces in VBoxManage command line arguments.
alphonsebelly
Posts: 4
Joined: 20. Jul 2010, 05:16
Primary OS: MS Windows 7
VBox Version: OSE Fedora
Guest OSses: windows 7

Re: how to make a copy of .VDI image?

Post by alphonsebelly »

I installed the software on a Ubuntu 9.04 server I maintain. When I ran sudo remastersys dist he began to install ubuntu-desktop and much more, without authorization Askin or something ... If I want a window manager is installed, I would have already installed .... I hope this does what I hope so, otherwise it becomes a huge waste of time. If forced to clean the server.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: how to make a copy of .VDI image?

Post by mpack »

"We must be the change we want to see". The change I want to see is you (a) posting questions in the correct forum, eg. Linux hosts or Linux Guests, and most importantly (b) not hijacking a totally unrelated thread!

I find it highly ironic that you took the time to find out how to add a signature, but apparantly couldn't take the time to read the title or subject matter of the thread you were posting in.
weirdo12
Posts: 2
Joined: 13. Oct 2010, 13:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows

Re:

Post by weirdo12 »

mhotze wrote:From the previous reply, making a copy works by releasing it, but adding this new copy to the virtualdiskmanager doesn't. It compes up with the error message:
"A hard disk with UUID {73d3fde6-8406-4e48-f29e-f0e927444f1a} or with the same properties ('/media/sda4/NewHardDisk2.vdi') is already registered."

It looks like the vdi image needs to have another UUID in order to work. Any other ideas? I would like to make a new virtual machine by just copying an existing one without having to re-install from a boot-cd.
Use the UUID to make the copy instead of the name of the VDI file. Using your example it would be:

VBoxManage clonehd 73d3fde6-8406-4e48-f29e-f0e927444f1a /media/sda4/NewHardDisk2.vdi --format VDI
Post Reply