I copied an entire VirtualBox (version 5.1.38) VM directory from my local machine to a remote machine. The problem is that the hard disk configured in the VM still points to the directory path on my local machine. When I try to add it again as a new hard disk, I get the following error -

$ VBoxManage modifyvm "Ubuntu 18.04.3" --hda /new/path.vdi
VBoxManage: error: Cannot register the hard disk '/new/path.vdi' {fb872a9f-bf14-4119-a5a4-22b2f823fafc} because a hard disk '/old/path.vdi' with UUID {fb872a9f-bf14-4119-a5a4-22b2f823fafc} already exists
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBoxWrap, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 179 of file VBoxManageDisk.cpp

I've searched the manual but could not find a way to delete/unregister the old hard disk or update its path. How do I change the path of the hard disk to point to new location (or delete the entry with old location and register a new one)?

Edit: I do not have access to VirtualBox GUI on the remote machine.

1 Answer 1


In the virtual machine storage settings, remove the old disk and then add the disk that's at the new location.

  • 1
    I forgot to mention in the question that I only have SSH access to the remote machine, so I was looking for a way to do it using VBoxManage CLI
    – nsane
    Oct 14, 2019 at 4:45
  • Same concept, but you just use VboxManage storageattach. Here's the relevant part of the documentation: virtualbox.org/manual/ch08.html#vboxmanage-storageattach Oct 15, 2019 at 2:47
  • storageattach did not work because vbox complained that hdd with old path was still attached to the VM. In the end I just changed the .vbox XML file to point to new location.
    – nsane
    Oct 15, 2019 at 6:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .