Skip to content

Instantly share code, notes, and snippets.

@spiegela
Last active September 3, 2018 23:16
Show Gist options
  • Select an option

  • Save spiegela/7f29bab1ea9e6e13820b to your computer and use it in GitHub Desktop.

Select an option

Save spiegela/7f29bab1ea9e6e13820b to your computer and use it in GitHub Desktop.
Add secondary disk to fusion vagrant box that gets destroyed along with the VM
config.vm.provider :vmware_fusion do |v|
vdiskmanager = '/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager'
dir = "#{ENV['PWD']}/.vagrant/additional-disks"
file_to_disk = "#{dir}/hd2.vmdk"
if ARGV[0] == "up"
unless File.directory?( dir )
Dir.mkdir dir
end
unless File.exists?( file_to_disk )
`#{vdiskmanager} -c -s 100GB -a lsilogic -t 0 #{file_to_disk}`
end
elsif ARGV[0] == "destroy"
`rm -f #{file_to_disk}`
end
v.vmx['scsi0:1.filename'] = file_to_disk
v.vmx['scsi0:1.present'] = 'TRUE'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment