Brian, The command looks correct.
Could be the loop not executing correctly, you should move it into the vm.config loop itself so it executes for each VM you are creating. Also - it could be that the disks are getting cleaned up after the vagrant up fails so you need to clear them out between iterations. When it is all working the drives will get removed when you "vagrant destroy". Look at my example here - https://github.com/kvietmeier/vagrant/tree/master/virtualbox/Ceph I create multiple drives for each VM I spin up. Notice how deeply the disk creation loop is nested. Also note the " unless File.exist?("#{servers["name"]}-OSD-0#{num}.vdi")" construct - it will check to see if the file exists first and not error out if it does. This might be easier to follow - I worked out the code using a single VM: https://github.com/kvietmeier/vagrant/tree/master/virtualbox/MultiDisk On Tue, Oct 15, 2019 at 9:30 AM Brian Carpenter <[email protected]> wrote: > There are no extra drives and the initial system drive is called: > centos-7-1-1.x86_64.vmdk > > Tried changing > (1..5).each do |hd| > > to > (2..5).each do |hd| > > And got the same thing > > A customization command failed: > > ["createmedium", "--filename", "./disk2.vdi", "--variant", "Fixed", > "--size", 20480] > > The following error was experienced: > > #<Vagrant::Errors::VBoxManageError: There was an error while executing > `VBoxManage`, a CLI used by Vagrant > for controlling VirtualBox. The command and stderr is shown below. > > Command: ["createmedium", "--filename", "./disk2.vdi", "--variant", > "Fixed", "--size", "20480"] > > Stderr: 0%... > Progress state: VBOX_E_FILE_ERROR > VBoxManage: error: Failed to create medium > VBoxManage: error: Could not create the medium storage unit > '/home/brian/projects/centos/disk2.vdi'. > VBoxManage: error: VDI: cannot create image > '/home/brian/projects/centos/disk2.vdi' (VERR_ALREADY_EXISTS) > VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component > MediumWrap, interface IMedium > VBoxManage: error: Context: "RTEXITCODE handleCreateMedium(HandlerArg*)" > at line 462 of file VBoxManageDisk.cpp > > > On Tue, Oct 15, 2019 at 11:11 AM Salty Vagrant <[email protected]> > wrote: > >> My guess would be that the default/system drive is created as disk1.vdi. >> Try starting at disk2. >> >> On 11 Oct 2019, at 15:16, Brian Carpenter wrote: >> >> I am trying to provision identical drives for a ZFS sandbox vm to learn >> ZFS but it seems to only create the first drive and then fail >> >> Vagrant.configure("2") do |config| >> config.vm.box = "centos/7" >> (1..5).each do |hd| >> config.vm.provider :virtualbox do |v| >> puts "harddrive #{hd}" >> v.customize ['createmedium', '--filename', >> "./disk#{hd}.vdi",'--variant', 'Fixed', '--size', 20 * 1024] >> >> v.customize ['storageattach', :id, '--storagectl', >> 'IDE', '--device', hd, '--type', 'hdd', '--medium', "./disk#{hd}.vdi"] >> end >> end >> end >> >> >> Output.... >> $vagrant up >> >> harddrive 1 >> harddrive 2 >> harddrive 3 >> harddrive 4 >> harddrive 5 >> harddrive 1 >> harddrive 2 >> harddrive 3 >> harddrive 4 >> harddrive 5 >> harddrive 1 >> harddrive 2 >> harddrive 3 >> harddrive 4 >> harddrive 5 >> Bringing machine 'default' up with 'virtualbox' provider... >> ==> default: Checking if box 'centos/7' version '1905.1' is up to date... >> ==> default: Clearing any previously set forwarded ports... >> ==> default: Clearing any previously set network interfaces... >> ==> default: Preparing network interfaces based on configuration... >> default: Adapter 1: nat >> ==> default: Forwarding ports... >> default: 22 (guest) => 2222 (host) (adapter 1) >> ==> default: Running 'pre-boot' VM customizations... >> A customization command failed: >> >> ["createmedium", "--filename", "./disk1.vdi", "--variant", "Fixed", >> "--size", 20480] >> >> The following error was experienced: >> >> #<Vagrant::Errors::VBoxManageError: There was an error while executing >> `VBoxManage`, a CLI used by Vagrant >> for controlling VirtualBox. The command and stderr is shown below. >> >> Command: ["createmedium", "--filename", "./disk1.vdi", "--variant", >> "Fixed", "--size", "20480"] >> >> Stderr: 0%... >> Progress state: VBOX_E_FILE_ERROR >> VBoxManage: error: Failed to create medium >> VBoxManage: error: Could not create the medium storage unit >> '/home/brian/projects/centos/disk1.vdi'. >> VBoxManage: error: VDI: cannot create image >> '/home/brian/projects/centos/disk1.vdi' (VERR_ALREADY_EXISTS) >> VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), >> component MediumWrap, interface IMedium >> VBoxManage: error: Context: "RTEXITCODE handleCreateMedium(HandlerArg*)" >> at line 462 of file VBoxManageDisk.cpp >> > >> >> Please fix this customization and try again. >> >> >> >> -- >> This mailing list is governed under the HashiCorp Community Guidelines - >> https://www.hashicorp.com/community-guidelines.html. Behavior in >> violation of those guidelines may result in your removal from this mailing >> list. >> >> GitHub Issues: https://github.com/mitchellh/vagrant/issues >> IRC: #vagrant on Freenode >> --- >> You received this message because you are subscribed to the Google Groups >> "Vagrant" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/vagrant-up/126acb4c-ad09-40bf-bc11-8e15c84a091a%40googlegroups.com >> <https://groups.google.com/d/msgid/vagrant-up/126acb4c-ad09-40bf-bc11-8e15c84a091a%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> -- >> This mailing list is governed under the HashiCorp Community Guidelines - >> https://www.hashicorp.com/community-guidelines.html. Behavior in >> violation of those guidelines may result in your removal from this mailing >> list. >> >> GitHub Issues: https://github.com/mitchellh/vagrant/issues >> IRC: #vagrant on Freenode >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "Vagrant" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/vagrant-up/yoheUgqb5TE/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/vagrant-up/5DC3E3F9-3A6B-4EBB-884A-98A2FBB4683A%40gmail.com >> <https://groups.google.com/d/msgid/vagrant-up/5DC3E3F9-3A6B-4EBB-884A-98A2FBB4683A%40gmail.com?utm_medium=email&utm_source=footer> >> . >> > > > -- > > > > [image: Western Oklahoma State College Logo] <https://www.wosc.edu/>Brian > Carpenter > Information Systems Specialist > Western Oklahoma State College <https://www.wosc.edu/> > 2801 N. Main St. *|* Altus, OK 73521 > <https://www.google.com/maps/place/Western+Oklahoma+State+College+Main+Building,+Altus,+OK+73521/@34.6694147,-99.3372287,18.87z/data=!3m1!5s0x87ab653a7bb9cc6f:0xd1063be3c99517db!4m5!3m4!1s0x87ab653a7bbd0569:0xc65b112658cc9ef!8m2!3d34.6689441!4d-99.336963> > (580) 477-7919 *|* Office: HLC 126 > [image: wosc facebook] <https://www.wosc.edu/facebook> [image: wosc > instagram] <https://www.wosc.edu/instagram> [image: wosc twitter] > <https://www.wosc.edu/twitter> [image: wosc snapchat] > <https://snapchat.com/add/woscevents> > > The mission of Western Oklahoma State College is to provide high quality > education, support student success, and empower individuals to become > productive members of local, regional, and global communities. > > -- > This mailing list is governed under the HashiCorp Community Guidelines - > https://www.hashicorp.com/community-guidelines.html. Behavior in > violation of those guidelines may result in your removal from this mailing > list. > > GitHub Issues: https://github.com/mitchellh/vagrant/issues > IRC: #vagrant on Freenode > --- > You received this message because you are subscribed to the Google Groups > "Vagrant" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/vagrant-up/CADwO3JMcN4StbG1TL9M_z6n3U%3DXYQ4eaCHBMbyhEDVecVxBNzg%40mail.gmail.com > <https://groups.google.com/d/msgid/vagrant-up/CADwO3JMcN4StbG1TL9M_z6n3U%3DXYQ4eaCHBMbyhEDVecVxBNzg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- --------------------------------------------------------------- Karl Vietmeier, Cloud Solutions Architect 949-300-7123 -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/mitchellh/vagrant/issues IRC: #vagrant on Freenode --- You received this message because you are subscribed to the Google Groups "Vagrant" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAC3PyVmV_RX92GPan1dEZh55_d-BgzRNJztDgJYAOX-ztfBYwg%40mail.gmail.com.
