我带有Vagrant和VirtualBox。
在我的Vagrantfile文件中,我有以下内容:
config.vm.provider "virtualbox" do |v|
v.customize [ "createhd", "--filename", "disk", "--size", 100000 ]
v.customize [ 'storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', "disk"]
end
当我使用vagrant up命令时,它会在C:\HashiCorp\Vagrant\bin\disk目录下寻找"disk"。
VBoxManage.exe: error: Could not find file for the medium 'C:\HashiCorp\Vagrant\bin\disk' (VERR_FILE_NOT_FOUND)
我希望将磁盘与虚拟机的第一块磁盘放在C:\Users\jma47\VirtualBox VMs\bin_build_1389371691目录下。
如何在Vagrantfile中实现这一目标?
line = \
vboxmanage list systemproperties`.split(/\n/).grep(/Default machine folder/).first`。 - Chloevboxmanage_path = "C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe"
然后line =
"#{vboxmanage_path}" list systemproperties.split(/\n/).grep(/Default machine folder/).first
然后vb_machine_folder = line.split(':', 2)[1].strip()
- EM0