VBoxManage clonehd fails

This is for discussing general topics about how to use VirtualBox.
Post Reply
jcobban
Posts: 13
Joined: 23. Feb 2010, 04:26
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: windows 7

VBoxManage clonehd fails

Post by jcobban »

Microsoft has damaged my Windows 7 virtual drive and refuses to run it. So I have to reinstall Windows 7. However since the install process warns that it may wipe out my data I want to clone the virtual disk before I allow M$ to destroy it. But clonehd refuses to run with the following gibberish.

/HardDisks$ VBoxManage clonehd Windows7.vdi WinBack.vdi
Oracle VM VirtualBox Command Line Management Interface Version 3.2.4
(C) 2005-2010 Oracle Corporation
All rights reserved.

ERROR: Cannot register the hard disk '/HardDisks/Windows7.vdi' with UUID {53853218-ce4f-4c76-969b-2b4244ce7733} because a hard disk '/HardDisks/Windows7.vdi' with UUID {53853218-ce4f-4c76-969b-2b4244ce7733} already exists in the media registry ('/home/jcobban/.VirtualBox/VirtualBox.xml')
Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBox, interface IVirtualBox, callee nsISupports
Context: "OpenHardDisk(Bstr(szFilenameAbs), AccessMode_ReadWrite, false, Bstr(""), false, Bstr(""), srcDisk.asOutParam())" at line 630 of file VBoxManageDisk.cpp

Why would VBoxManage want to register the source disk in the clone operation? I can see why it might want to register the target disk.

Why would VBoxManage want to register a disk that is already in the media registry? Why would it object when the disk already exists?

How do I clone this disk?

The registry file the message refers to reads:

<?xml version="1.0"?>
<VirtualBox xmlns="http://www.innotek.de/VirtualBox-settings" version="1.9-linux">
<Global>
<ExtraData>
<ExtraDataItem name="GUI/LastVMSelected" value="af029900-600b-44e7-964d-f289fe7925e9"/>
<ExtraDataItem name="GUI/LastWindowPostion" value="298,107,770,550"/>
<ExtraDataItem name="GUI/LicenseAgreed" value="7,8"/>
<ExtraDataItem name="GUI/SUNOnlineData" value="triesLeft=0"/>
<ExtraDataItem name="GUI/SuppressMessages" value=",remindAboutWrongColorDepth,remindAboutAutoCapture,remindAboutMouseIntegrationOn,remindAboutMouseIntegrationOff"/>
<ExtraDataItem name="GUI/UpdateCheckCount" value="47"/>
<ExtraDataItem name="GUI/UpdateDate" value="1 d, 2010-08-15, stable"/>
</ExtraData>
<MachineRegistry>
<MachineEntry uuid="{af029900-600b-44e7-964d-f289fe7925e9}" src="Machines/Windows 7/Windows 7.xml"/>
</MachineRegistry>
<MediaRegistry>
<HardDisks>
<HardDisk uuid="{53853218-ce4f-4c76-969b-2b4244ce7733}" location="/HardDisks/Windows7.vdi" format="VDI" type="Normal"/>
</HardDisks>
<DVDImages>
<Image uuid="{11264970-42a3-4d47-b32f-9208ce5c94eb}" location="/usr/share/virtualbox/VBoxGuestAdditions.iso"/>
</DVDImages>
<FloppyImages/>
</MediaRegistry>
<NetserviceRegistry>
<DHCPServers>
<DHCPServer networkName="HostInterfaceNetworking-vboxnet0" IPAddress="192.168.56.100" networkMask="255.255.255.0" lowerIP="192.168.56.101" upperIP="192.168.56.254" enabled="1"/>
</DHCPServers>
</NetserviceRegistry>
<SystemProperties defaultMachineFolder="Machines" defaultHardDiskFolder="HardDisks" defaultHardDiskFormat="VDI" remoteDisplayAuthLibrary="VRDPAuth" webServiceAuthLibrary="VRDPAuth" LogHistoryCount="3"/>
<USBDeviceFilters/>
</Global>
</VirtualBox>
pgh
Posts: 31
Joined: 4. May 2009, 16:00
Primary OS: Other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Plenty
Location: Coruscant

Re: VBoxManage clonehd fails

Post by pgh »

If you don't have any snap shots then just copy the *.vdi file to another location. It sounds like it is corrupt anyway but at least you will have the copy for what that is worth.
jcobban
Posts: 13
Joined: 23. Feb 2010, 04:26
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: windows 7

Re: VBoxManage clonehd fails

Post by jcobban »

pgh wrote:If you don't have any snap shots then just copy the *.vdi file to another location. It sounds like it is corrupt anyway but at least you will have the copy for what that is worth.
But I won't be able to access the copy of the .vdi file from the VM because it will have the same UUID as the original disk. This is the same problem you encounter if you clone a physical disk. You need to not only copy the data that is on the drive, you also need to assign a new UUID to it. If I cannot access the cloned drive, I cannot copy anything from it to replace whatever the Win7 installation destroys.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: VBoxManage clonehd fails

Post by mpack »

If you merely copy the VDI file using the host OS then you are correct, you could not have the copy registered at the same time as the original, because of matching UUIDs. However if I understand your situation correctly then you don't need both registered at the same time, all you need is the ability to restore a file if it gets hosed by something you are about to try.

However, if you really want to register both VDIs at the same time then :-

Code: Select all

VBoxManage internalcommands sethduuid <vdifilename>
Changes the UUID in an existing VDI (which could be an OS made copy).
Post Reply