There are numerous steps online for manually increasing the vagrant disk size, for example: link
It would be great if the resize could be done automatically in the Vagrantfile
, something like this:
config.vm.provider :virtualbox do |vb|
if first_up # only run on the first 'up' command
disk_uuid = ? # how to get the disk_uuid?
vb.customize ["modifyhd", disk_uuid, "--resize", "15360"]
config.vm.provision "shell", path: "resize2fs -p -F /dev/sda"
end
end
Question: How can I find out the disk uuid in a cross platform way?
Question: Is this all that is required to resize the guest's disk?
Command: vagrant destroy [name|id] This command stops the running machine Vagrant is managing and destroys all resources that were created during the machine creation process. After running this command, your computer should be left at a clean state, as if you never created the guest machine in the first place.
I have found the following options to be useful:
1) Add another disk to the Vagrant box.
See my answer to a similar question on AskUbuntu here.
2) Use Opscode Vagrant boxes which tend to have 40Gb disks
See the opscode page for more information.
3) Use packer to create your own box.
After reading the packer tutorials, you can start by copying the packer definitions from somewhere else (e.g. opscode) and tweak the disk size.
Some more information:
An issue was raised on Vagrant's issue tracker about extending vagrant disks.
There is a vagrant-disksize plugin.
You can install it by executing:
vagrant plugin install vagrant-disksize
Then you can include it in the Vagrantfile like this:
Vagrant.configure('2') do |config|
config.vm.box = 'ubuntu/xenial64'
config.disksize.size = '50GB'
end
Its limited at the moment only to the first disk.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With