VirtualBox and cloning virtual hard disk drives

After breaking my VMWare Workstation install by upgrading to the latest kernel, I decided to give VirtualBox a try. VirtualBox comes in two flavors, the full version and the open source edition (OSE). I have had a great time creating virtual machines in VirtualBox, the application really is quite solid. I am seeing performance similar to what I am use to with VMWare.

I primarily use virtual machines for testing production type systems in an environment that I can experiment with. Something about trying out new products and ideas seems to worry my clients and end users, no surprise there. With that being said, I have created a Windows 2008 Standard addition VM, a Windows XP Professional VM, and a Windows Vista Business VM. That is about where I would like the creation to stop, I want to simulate multiple client machines, but I do not want to manually load all of the client systems. In VMWare it is quite straight forward, you simply shut the VM down, highlight it and click on Clone. Well VirtualBox is almost that straight forward, but you have to do the cloning from the command line, and more importantly, you must use absolute paths.

The command is documented in many places across the web, but most if not all of them that I found were something like this:

VBoxManage clonevdi yourvirtualhdd.vdi yourclonedvirtualhdd.vdi

The problem with this is that the above command uses relative paths which is kind of standard for most apps, not VirtualBox. So in my case the command would actually look like this:

VBoxManage clonevdi /home/himuraken/VM/VirtualBox/BaseInstalls/yourvirtualdd.vdi /home/himuraken/VM/VirtualBox/BaseInstalls/yourclonedvirtualhdd.vdi

This may appear complex or difficult to understand for some but just understand it this way, you need to provide the full path to the image you want to clone and the full path to the location you want to store the cloned VDI to.

–Himuraken

2 thoughts on “VirtualBox and cloning virtual hard disk drives”

  1. This does not work in Virtualbox 2.1.0 due to a bug in the clonevdi code …

    The workaround is simple

    copy your original VDI file using normal file copy mechanisms (e.g., “cp WindowsXP.vdi copyOfWinXP.vdi”)
    type “VBoxManage internalcommands sethduuid copyOfWinXP.vdi”

    The bug has been fixed for a future release of Virtualbox (see their buglist)

    Regards

Leave a Comment

one × 5 =