移动virtualbox虚拟机目录

1,383 阅读2分钟

#1 菜单->管理->全局设定 ,更改 默认虚拟电脑位置

#2 复制/移动 现有虚拟机目录到新位置,软件里删除现有虚拟机

#3 菜单->控制->注册(ctrl+A),逐个选择虚拟机目录里的 .vbox文件,导进虚拟机配置

#4 错误信息

Could not find an open hard disk with UUID {1d61419f-6d30-45d0-9e4f-6d53a8e48e6d}.

打开.vbox文件进行编辑,将其中含有1d61419f-6d30-45d0-9e4f-6d53a8e48e6d这个UUID的地方去掉,如:

<AttachedDevice type="HardDisk" port="0" device="0">
    <Image uuid="{1d61419f-6d30-45d0-9e4f-6d53a8e48e6d}"/>
</AttachedDevice>

Could not read from Boot Medium! System Halted

原因是迁移后IDE控制器里的虚拟磁盘.vdi丢失,解决方法是在该虚拟系统的设置中找到存储选项,在SATA控制器上选择添加虚拟硬盘,然后加载你的vdi文件,一般在迁移后的虚拟机目录中,比如F:\VirtualBox VMs\homestead-7\box-disk001.vmdk

Trying to open a VM config which has the same UUID as an existing virtual machine

You can use VBoxManage internalcommands sethduuid <VDI/VMDK file>(Run from the VBox install directory) to change the HD UUID, but this has two shortcomings: it does not update the .vbox file, and it does not change the machine UUID (I did not find any way to do this with VBoxManage), just the HD UUID.

The following worked for me (Win 7, most recent VirtualBox version):

run VBoxManage internalcommands sethduuid <VDI/VMDK file> twice (the first time is just to conveniently generate an UUID, you could use any other UUID generation method instead)
open the .vbox file in a text editor
replace the UUID found in <Machine uuid="{...}" with the UUID you got when you ran sethduuid the first time
replace the UUID found in <HardDisk uuid="{...}" and in <Image uuid="{}" (towards the end) with the UUID you got when you ran sethduuid the second time
You can add the virtual machine after that. Not a very clean solution, but does not seem to cause any problem.