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.