Workaround for problems cloning a VirtualBox disk

I've been playing with VirtualBox a lot in the last month; I'm hoping to switch from VMware Workstation on my Ubuntu box and VMware Fusion on my Mac Book Pro.  Don't get me wrong; I've been using VMware for years, but now that there's a free solution that seems to work well, I thought I'd try it.  Plus, VirtualBox works on Solaris and OpenSolaris, so I can use it on my home fileserver to run Windows-based services on the same box.  Nice.

One of the great things about these virtual machines is that your whole environment is just a single file on disk.  Want to do play around with your operating system?  No problem; just make a backup copy of the .vdi file (or in VMware land, your .vmdk file), which is your OS disk.  I like to create a VM, install my standard Windows XP OS and applications, then make a copy of that image so that later, when the OS gets corrupted by viruses and what not, I can go back to a nice, safe working state.

There's an easy way to make copies of your virtual machine in VirtualBox.  If your virtual machine's hard disk is called something like "WindowsXP.vdi", just type "VBoxManage clonevdi WindowsXP.vdi copyOfWinXP.vdi" and VirtualBox will create a nice copy of your Windows image, saving it in a file called "copyOfWinXP.vdi".

Except that it doesn't work with VirtualBox 2.1.0.  There's a bug, bug #2813, that prevents the cloning from working exactly right.  The result is that you'll have problems booting up your virtual machine.  The bug is known and a fix is already checked into the source tree for a future version, but until then, here's the workaround:

  • copy your original VDI file using normal file copy mechanisms (e.g., "cp WindowsXP.vdi copyOfWinXP.vdi")
  • type "VBoxManage internalcommands sethduuid copyOfWinXP.vdi"
You can now safely use this new VDI file in VirtualBox.  Launch VirtualBox, open the Virtual Media Manager, and tell it to add this "copyOfWinXP.vdi" (or whatever you're calling your image).  Then when you create a new virtual machine within VirtualBox, you can tell that virtual machine to use this new VDI, no problem.

Powered by ScribeFire.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle. What more do you need to know, really?

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today