Cloning Virtual Box Images in Windows 7

I use VirtualBox from Sun to do SQL testing since it supports 64-bit guest images, which I want need for some things, like Windows 2008 R2, which only comes in x64.

However I hate reinstalling stuff that I don’t need to. And with a multitude of SQL versions, and a question today on eval edition (which I never install), I wanted to be sure I could quickly setup a new image when needed. In older VM software, I’ve just copied a VHD disk image and then added a new VM with it. However it’s not as simple with Virtual Box.

I found a nice procedure from Stuart’s Notes on cloning and copying images, so I started there, but found a few differences on my machine, so here’s what I did.

Found my Virtual Box files, which are located at: C:\Users\Steve\.VirtualBox\HardDisks (note, this is different than Stuart’s procedure. This is where things were installed on my Windows 7 x64 machine. I don’t have a “VDI” folder.

In Windows, you can right click this in the Explorer and get the path. I then pasted that with a “CD” in front of it in a command prompt.


Next I grabbed the path to the Virtual Box installation, since I need to run the “vboxmanage.exe” program. For me, the path was “C:\Program Files\Sun\VirtualBox”

VirtualBox2  At this point, I essentially needed to run

vboxmanage clonevdi  “Old Disk" "new disk"

That, however, doesn’t really work easily in Windows. Instead, you need pathing, quotes, and other things to ensure that you get a copy. I had to run this:

C:\Users\Steve\.VirtualBox\HardDisks>"C:\Program Files\Sun\VirtualBox\vboxmanage
" clonevdi  "Win7 64.vdi" "Win7 SQL 2K.vdi"

This completed, with these results:


From there, I fired  up Virtual Box, and created a new machine. I named it picked the old OS, and then got to the Virtual Disk dialog:


I clicked the button that has the arrow in the image. This brings up the disk selection dialog. I clicked “Add”


From there, the next step was to select my new disk image:


I picked it, then closed the dialog and I saw this image listed for my VM.


Complete the wizard, click start, and I had a clone of my virtual machine, same state, guest additions installed, and same pwd. I changed the background for my guest and then installed the software I needed on this one.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , , . Bookmark the permalink.