VirtualBox

Ticket #10096 (new defect)

Opened 2 years ago

Last modified 5 months ago

VBoxManage clonevm adds cloned disk to media manager when not requested

Reported by: powelly Owned by:
Priority: major Component: VM control
Version: VirtualBox 4.1.8 Keywords:
Cc: Guest type: other
Host type: Linux

Description

The VBoxManage clonevm command adds the cloned harddisk to the media manager even when the "--register" option is not used.

This causes clonevm to fail when used more than once.

For example:

~> VBoxManage clonevm Mercury --mode all --basefolder "/mnt/Bronze Backup/Virtual Machines" --name Mercury
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Machine has been successfully cloned as "Mercury"

~> rm -r /mnt/Bronze\ Backup/Virtual\ Machines/Mercury/

~> VBoxManage clonevm Mercury --mode all --basefolder "/mnt/Bronze Backup/Virtual Machines" --name Mercury
0%...10%...20%...30%...40%...50%...60%...70%...80%...
Progress state: NS_ERROR_INVALID_ARG
VBoxManage: error: Cannot register the hard disk '/mnt/Bronze Backup/Virtual Machines/Mercury/Mercury.vdi' {da9523a4-5d83-4cfe-bc80-10344c6d424f} because a
hard disk '/mnt/Bronze Backup/Virtual Machines/Mercury/Mercury.vdi' with UUID {cf6bdde6-3425-47c0-b875-329ddb4cfe67} already exists
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component Machine, interface IMachine, callee

Change History

comment:1 Changed 20 months ago by ken_yap

I'm affected by this bug too, it's still in 4.1.20. Surely it can't be that hard to fix? Every time I clone a VM I have to unregister the media manually. Is there a way to unregister the media from VBoxManage? I couldn't find it.

comment:2 Changed 5 months ago by ack_steady

Bug still exists in 4.2.16.

Here's a bash snippet I use to remove the clone VHD after cloning the VM:

# $vm_uuid is for the VM that was cloned
backup_hdd_uuids=`vboxmanage list hdds | grep -B3 "$vm_uuid Clone" | grep '^UUID' | cut -d':' -f2 | tr -d ' '`
for hdd_uuid in $backup_hdd_uuids
do
    # Uncomment the following line to make this script work.
    # NOTE that this script will not work properly in certain cases - one I'm aware of is if the VM has more than 3 HDDs.
    # vboxmanage closemedium disk $hdd_uuid
    echo "Removed $hdd_uuid"
done

comment:3 Changed 5 months ago by juancarlos

After dealing with same issue, I posted a workaround here

 https://forums.virtualbox.org/viewtopic.php?f=1&t=58463

Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use