cant clone disk twice

Discussion about using the VirtualBox API, Tutorials, Samples.
Post Reply
klevchenko
Posts: 6
Joined: 16. May 2020, 09:47

cant clone disk twice

Post by klevchenko »

I use vmdk image with pre-installed os osboxes to create ready to use vm and
i got problem with clonhdd

command VBoxManage clonehd {image_path} {new_disk_path}

after one successful clone on next clone i got error
VBoxManage: error: UUID {00000000-0000-0000-0000-000000000000} of the medium '/home/klevchenko/vbox_imgs/Ubuntu 16.04.6 (64bit).vmdk' does not match the value {0f5418b0-060f-4da8-b059-4661476d65f1} stored in the media registry ('/home/klevchenko/.config/VirtualBox/VirtualBox.xml')
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MediumWrap, interface IMedium, callee nsISupports
VBoxManage: error: Context: "CloneTo(pDstMedium, ComSafeArrayAsInParam(l_variants), NULL, pProgress.asOutParam())" at line 1068 of file VBoxManageDisk.cpp
so it happened because hard disk entry is created in file:
/home/klevchenko/.config/VirtualBox/VirtualBox.xml
it looks like
<HardDisk uuid="{0f5418b0-060f-4da8-b059-4661476d65f1}" location="/home/klevchenko/vbox_imgs/Ubuntu 16.04.6 (64bit).vmdk" format="VMDK" type="Normal"/>
if i remove it from file new hdd can be cloned, but if i use multiprocessing it clone ones and crush

so my question how i can clone hdd without make entry in config file
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: cant clone disk twice

Post by mpack »

VMDKs do not necessarily include a UUID, which VirtualBox requires, especially if the VMDK is to be used bare, and more than once.

I suggest that you convert the VMDK to VDI. Then you can clone the VDI as required. Better yet, build the VDI into a VM, and clone the VM, not the bare VDI.
Post Reply