In 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 display an error shown below.
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.
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’ Way
Cloning a disk an command-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 VBoxManage tool will chug away the used UUID and clone the disk for you, by creating a new UUID in the process:
Start a cmd box and go to the directory "C:\Program Files\Oracle\VirtualBox"
Then execute [VBoxManage clonehd "F:\vmware\RAC1\node_rac1.vdi" "F:\vmware\RAC2\node_rac1.vdi"]
C:\Program Files\Oracle\VirtualBox>VBoxManage clonehd "F:\vmware\RAC1\node_rac1.vdi" "F:\vmware\RAC2\node_rac1.vdi" C:\Program Files\Oracle\VirtualBox>VBoxManage clonehd "F:\vmware\RAC1\node_rac1.vdi" "F:\vmware\RAC2\node_rac2.vdi" Oracle VM VirtualBox Command Line Management Interface Version 3.2.0(C) 2005-2010 Oracle Corporation All rights reserved. 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Clone hard disk created in format 'VDI'. UUID: 738b60bc-98e0-4380-b179-d3d8b3abd7e4 C:\Program Files\Oracle\VirtualBox>
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’ Way
The alternative to the CloneHd tool is an undocumented option available in VBoxManage – the setvdiuuid command. As the command help states: ‘This is a development tool and shall only be used to analyse problems. It is completely unsupported and will change in incompatible ways without warning’. Because of this, I don’t accept any responsibility if you completely destroy your VM using this procedure.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.
thanks for the tip
ReplyDeleteHi !
ReplyDeleteI'm running a VM Win 98 SE on Linux mint 14 cinammom with Oracle Virtubox . How can I copy or clone my 2 GB virtual hdd on a bigger virtual hdd ?
thanks in advance
Caron
Mauritius Island
Indian Ocean
230 794 23 93
Hi Caron,
ReplyDeleteWhat i will use is create a new virtual environmant with Export Virtual Applicance - Import Virtual Applicance.
Chers Jos