I want to create vm using vagrant with 2 disks. vm is showing error on gui "FATAL: Could not read from boot medium". It runs fine if created without any disk any disk. Here is my Vagrantfile:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "cn1" do |cn1|
cn1.vm.box = "trusty"
cn1.vm.hostname = "cn1"
cn1.vm.network "private_network", ip: "192.168.100.11"
cn1.vm.network "private_network", ip: "10.10.10.11"
cn1.vm.host_name = "controller1"
cn1.vm.provider :virtualbox do |vb|
vb.memory = 500
vb.customize ["createhd", "--filename", "machine1_disk0", "--size", "8192"]
vb.customize ["createhd", "--filename", "machine1_disk1", "--size", "8192"]
vb.customize ["storagectl", :id, "--name", "SATA Controller", "--remove"]
vb.customize ["storagectl", :id, "--name", "SATA Controller", "--add", "sata"]
vb.customize ["storageattach", :id, "--storagectl", "SATA Controller", "--port", "1", "--type", "hdd", "--medium", "machine1_disk0.vdi"]
vb.customize ["storageattach", :id, "--storagectl", "SATA Controller", "--port", "2", "--type", "hdd", "--medium", "machine1_disk1.vdi"]
vb.gui = true
end
end
end
VirtualBox is telling you that you cannot boot from your disk.
If you open VirtualBox and look at the settings of your VM, under storage, you'll find that you have your 2 disks as you declared but the base image is not attached.
If you now look on your file system (location depends on your OS, I am on mac) for this VM
fhenri@machine:~/Documents/Virtual Machines.localized/trusty_cn1_1454620633289_44965$ ll
total 3174824
drwx------ 6 fhenri staff 204 4 fév 22:17 .
drwxr-xr-x 12 fhenri staff 408 4 fév 22:17 ..
drwx------ 3 fhenri staff 102 4 fév 22:17 Logs
-rw------- 1 fhenri staff 1625489408 4 fév 22:19 box-disk1.vmdk
-rw------- 1 fhenri staff 8488 4 fév 22:17 trusty_cn1_1454620633289_44965.vbox
-rw------- 1 fhenri staff 8143 4 fév 22:17 trusty_cn1_1454620633289_44965.vbox-prev
so vagrant has imported the box in the box-disk1.vmdk
but you have removed this disk and added 2 blank disk so you cannot boot.
If you remove those 2 lines
vb.customize ["storagectl", :id, "--name", "SATAController", "--remove"]
vb.customize ["storagectl", :id, "--name", "SATAController", "--add", "sata"]
Then the disk remains attached to the VM and you can boot.
Now if you open the VM settings in VirtualBox, you'll find 3 disks (under the SATA Controller):