Last active
August 24, 2024 07:28
-
-
Save jtopper/8588263 to your computer and use it in GitHub Desktop.
Add a new disk to a VMWare vagrant box
This file contains 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 |vm| | |
vdiskmanager = '/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager' | |
dir = "#{ENV['HOME']}/vagrant-additional-disk" | |
unless File.directory?( dir ) | |
Dir.mkdir dir | |
end | |
file_to_disk = "#{dir}/var-lib-mysql.vmdk" | |
unless File.exists?( file_to_disk ) | |
`#{vdiskmanager} -c -s 20GB -a lsilogic -t 1 #{file_to_disk}` | |
end | |
vm.vmx['scsi0:1.filename'] = file_to_disk | |
vm.vmx['scsi0:1.present'] = 'TRUE' | |
vm.vmx['scsi0:1.redo'] = '' | |
end | |
config.vm.provision :shell, :inline => | |
"set -x && " + | |
"mkdir -p /var/lib/mysql && " + | |
"grep -q sdb1 /proc/partitions || ( " + | |
"echo ',,83' | sfdisk -q -D /dev/sdb && " + | |
"mkfs.ext4 /dev/sdb1 " + | |
") && " + | |
"grep -q sdb1 /etc/fstab || echo '/dev/sdb1 /var/lib/mysql ext4 defaults 0 0' >> /etc/fstab && " + | |
"grep -q /var/lib/mysql /proc/mounts || mount /var/lib/mysql" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For some reason all of these options caused vmrun to crash:
But the three lined below did work for me, so sharing here for anyone having the same issue: