Published by Nick Heppleston on Wednesday, 17th June 2009 in VirtualBox and Virtualisation. 7 Comments
With VMWare’s various offerings, copying a virtual disk is easy: copy the disk in Windows Explorer and add it to a newly created VM; VMWare will detect that the disk was a copy and create a new unique identifier (UUID) for the disk before adding it to the VM. Easy and painless. Not so with VirtualBox.
With VirtualBox, copying a virtual disk is a bit of a pain. If you copy the disk in Windows Explorer and try and use it in a new VM, VirtualBox will have a hissy fit and display the error shown below. A bit of a ‘wordy’ way to say that it already knows about this disk, don’t you think?
The publicised way around this is to use the command-line VBoxManage CloneHd tool, however there is another – secret and undocumented – way to clone a disk: the setvdiuuid tool. Lets look at these two methods in detail.
Cloning a Virtual Disk – The ‘Supported’ Method
Cloning a disk is (IMHO) a clunky and Unix-y type way of creating a duplicate disk. We need to invoke the CloneHd command of the VBoxManage tool, supplying the disk to clone and the name of the new ‘cloned’ disk. In its simplest form, you would do something like this at the command-line:
VBoxManage clonehd "DiskToClone.vdi" "ClonedDisk.vdi"
The cloned disk can now be used on a new VM without incurring the ‘I already know about this disk’ error.
Copying a Disk – The ‘Unsupported’ Method
To use the tool, simply create a copy of the virtual disk’s VDI file in Windows Explorer; open the Windows command-line and issue the setvdiuuid command for the newly copied disk:
VBoxManage internalcommands setvdiuuid "CopiedDisk.vdi"
The tool will create a new UUID and assign it to the disk:
The new copied disk can now be used on a new VM without incurring the ‘I already know about this disk’ error.