Problem

VBoxManage: error: Cannot register the hard disk '...' because a hard disk '.../.vdi' with UUID {...} already exists

This error can also happen when trying to resize an .vdi image while it is still mapped  to a VM.

Analysis

  • Locate your .vdi file.
  • Remove any snapshots in the VirtualBox
    (in menu: File – Virtual Media Manager)
  • Detach the .vdi from your VM, then map it back:
  1. Open the Oracle VM VirtuaBox Manager
    Click on File -> Virtual Media Manager (or Ctrl+D)
  2. Delete the hard disk entry in question (select and press “Del” on keyboard)
  3. Open “Settings” of the Virtual Machine, go to “Storage”, click “Add Attachment”, select “Add Hard Disk” and “Choose existing disk”, then selected the vdi file and you are done.

Solution

# VBoxManage internalcommands sethduuid Win7disk.vdi
VBoxManage: error: Cannot register the hard disk ‘…’ because a hard disk ‘…/.vdi’ with UUID {…} already exists
Tagged on: