Last active
September 3, 2018 23:16
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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