Skip to content

Instantly share code, notes, and snippets.

@kun432
Forked from leifg/Vagrantfile
Last active August 29, 2015 14:01
Show Gist options
  • Save kun432/6de257e4fdf892c4d76d to your computer and use it in GitHub Desktop.
Save kun432/6de257e4fdf892c4d76d to your computer and use it in GitHub Desktop.
Add two or more disks to system using Vagrant
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = 'base'
config.vm.provider "virtualbox" do |vb|
disk_num = 4
disk_size = 4096
i = 0
while i < disk_num do
file_to_disk = "./box-disk#{i}.vmdk"
unless File.exist?(file_to_disk)
vb.customize ['createhd', '--filename', file_to_disk, '--size', disk_size]
end
vb.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', i + 1, '--device', 0, '--type', 'hdd', '--medium', file_to_disk]
i += 1
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment