当服务器掉电,导致vagrant 启动虚拟机时报类似于以下的错误时,可以使用本方法。
There was an error while executing VBoxManage
, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: [“startvm”, “a8b30158-3348-46bd-8511-02db87c4236a”, “–type”, “headless”]
Stderr: VBoxManage: error: Could not open the medium ‘/home/VirtualBox VMs/vmware11/vagrant-virtualbox-box.vmdk’.
VBoxManage: error: VMDK: inconsistency between grain table and backup grain table in ‘/home/VirtualBox VMs/vmware11/vagrant-virtualbox-box.vmdk’ (VERR_VD_VMDK_INVALID_HEADER).
VBoxManage: error: VD: error VERR_VD_VMDK_INVALID_HEADER opening image file ‘/home/VirtualBox VMs/vmware11/vagrant-virtualbox-box.vmdk’ (VERR_VD_VMDK_INVALID_HEADER)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MediumWrap, interface IMedium
解决方法
下载 vmware-vdiskmanager (VMware-vix-disklib-7.0.2-17696664.x86_64.tar.gz) 即 vdd
./vmware-vdiskmanager -R ‘/home/VirtualBox VMs/vmware11/vagrant-virtualbox-box.vmdk’