hashicorp / vagrant

Vagrant is a tool for building and distributing development environments.
https://www.vagrantup.com
Other
26.21k stars 4.43k forks source link

Enhancement Request: Disk resize for vmware provider #13351

Open dastonzerg opened 7 months ago

dastonzerg commented 7 months ago

Is your feature request related to a problem? Please describe. I am using Macbook pro M1. I am using vmware fusion as the provider and have installed vagrant-vmware-desktop plugin. I am trying to follow https://developer.hashicorp.com/vagrant/docs/disks/usage to resize a VM I have created. However it has no effect after I added config.vm.disk :disk, size: "100GB", primary: true and do vagrant halt then vagrant up.

I even tried with v.gui = true and then I was able to see the VM in vmware fusion, I tried to resize the hard disk after deleting the snapshots, but disk size doesn't change at all. Attaching a new disk also didn't help.

I just started to use Vagrant yesterday and I really like it. Appreciate the community for developing it! I hope there is at least a workaround for resizing disk for vmware provided VMs.

Describe the solution you'd like Add config.vm.disk :disk, size: "100GB", primary: true and it should work like described in https://developer.hashicorp.com/vagrant/docs/disks/usage for vmware provider. I noticed that it says "Currently, only VirtualBox is supported." currently.

Describe alternatives you've considered N/A

Additional context N/A

dastonzerg commented 7 months ago

There is a related thread in discuss.hashicorp.com asking about this How to resize virtual hard drive with vmware-desktop but there is no response yet.

ghost commented 3 months ago

I'm also facing the same issue. the disk is full ~30GB. I changed the vagrantfile to specify 100GB; and also tried adding a second disk in there; but I don't see any change when I run df in the guest VM. I'm running Ubuntu 22.04 in the VM; vagrant is running on a host Mac (Sonoma/Apple Silicon).

I also looked if this could be done manually from VMWare itself, but this option is disabled because the VM is a 'linked clone':

Screenshot 2024-06-06 at 1 19 48 PM

I wasn't familiar with the term, so I tried adding the following in my Vagrantfile:

vm.linked_clone = false

but the option is still grayed out. perhaps I have to make a new VM from scratch with that linked clone setting false.

Did you ever find a solution @dastonzerg ?

ghost commented 3 months ago

I tried creating a brand new vagrant provisioned Ubuntu 22.04 VM, with 100GB set both in the Vagrantfile as well as the VMWare desktop GUI settings; made sure snapshots were deleted; and the Vagrantfile set linked_clones to false. When I log into the machine with vagrant ssh, It still thinks the available disk size is under 30GB.

Anyone else have ideas?

ChristoWolf commented 1 month ago

I think this is part of by #112. @chrisroberts, can you please confirm?

ChristoWolf commented 1 month ago

Even after trying the v3.0.4 plugin with VMware Workstation Pro, the disk does not grow when uping. Am I missing something?

Stromweld commented 1 month ago

There is the VM disk size and OS part to expanding. To grow a disk you need cloud-init auto grow turned on. Otherwise you have to manually expand the partition and then expand the file system to use the newly expanded partition. Clouds like AWS and azure do it through cloud-init or their agent/software running on the cloud instance.

ChristoWolf commented 1 month ago

Wow, of course, I completely forgot to consider partitioning. Thanks for clarifying!