Parallels / vagrant-parallels

Vagrant Parallels Provider
https://parallels.github.io/vagrant-parallels
MIT License
994 stars 87 forks source link

How to set/enlarge disk #360

Open matthew-gill opened 4 years ago

matthew-gill commented 4 years ago

By default the disk size is 32gb. How do I tell the vagrantfile to use a larger storage space?

legal90 commented 3 years ago

Hi @matthew-gill Sorry for the late response. You asked a good question - apparently there is no a reliable way to change the disk size at this moment.

In fact, that could be done using this customization rule:

  config.vm.provider "parallels" do |prl|
    prl.customize "post-import", ["set", :id, "--device-set", "hdd0", "--size", "40000"]
  end

But that will fail if in the past there was at least one linked clone created from this base box:

#<VagrantPlugins::Parallels::Errors::ExecutionError: There was an error while command execution. The command and stderr is shown below.

Command: ["/usr/local/bin/prlctl", "set", "a0963bf0-5333-42eb-b428-1764a6031a65", "--device-set", "hdd0", "--size", "40000"]

Stderr: Failed to resize: This virtual hard disk cannot be resized because it has one or more snapshots. To resize the disk, delete the snapshots and try again.
Failed to configure the virtual machine.

Details This error message is saying about the one special snapshot of the base box disk which is used as a common "node" (starting point) for all potential linked clones created from this base box. And unfortunately we can't remove this snapshot, because that will corrupt all existing linked clones.

@andreydanin, do you know if there is a way to increase the disk size of linked clone without affecting the source disk image?

matthew-gill commented 3 years ago

@legal90 thanks for looking into this! For now we have a workaround where we manually Mount and partition a new disk, but it's not ideal!

jamesmartin commented 3 years ago

👋 any movement on this? I'm trying to achieve the same thing.

kgifford-hv commented 2 years ago

So, I understand the underlying difficulty in accomplishing this mentioned by @legal90.

That said, there are some of us where the danger, "...unfortunately we can't remove this snapshot, because that will corrupt all existing linked clones." is irrelevant.

The fact that I used to have a version of my VM that used linked cloning is vestigial.

The reality is, I only need/use exactly 1 VM (at a time; I often vagrant destroy / vagrant up as necessary). This one VM references my one and only base box. I used to be okay with our company-wide Vagrantfile that used linked cloning.

However, a subset of us now need larger disks. We have a per-developer Vagrantfile.local that we can define to override general settings. I can almost use it to enlarge my disk by disabling linked cloning and using prl.customize to set a new/larger disk size. Only the snapshot (from prior instances of the VM that did use linked cloning of the base box, but have since all been nuked) gets in the way.

I'd love a way to have vagrant-parallels give me the option to explicitly request any/all such snapshots be nuked (prlctl snapshot-delete ...) regardless of the "danger". Perhaps force me to include some extra parameter that essentially says, "I understand the risk associated with deleting any such snapshots of the base box's disk, but my circumstances are such that I'm declaring it's okay".

I'd just work around this myself if there were a way for me, within the context of the Vagrantfile's main block, to run prlctl commands (like prl.customize) but where I could get the output. I'd manually list and nuke any such snapshots prior to requesting the modified disk size.

zarinfam commented 1 year ago

Do you know if there is any progress on this issue? I have this problem too.

dogukancagatay commented 1 year ago

I tackled this problem when creating Vagrant boxes for the Parallels provider, and found this solution.

You need those snapshots deleted, which is done with prl_disk_tool merge and prl_disk_tool compact commands.

prl_disk_tool merge --hdd vm.pvm/harddisk1.hdd
prl_disk_tool compact --hdd vm.pvm/harddisk1.hdd
luiscantor commented 8 months ago

You'll need to execute this command first:

vagrant plugin install vagrant-disksize

and then add a line like this to your vagrantfile: config.disksize.size = '60GB'

I was having the same problem and this was the solution for me.

markush81 commented 8 months ago

You'll need to execute this command first:

vagrant plugin install vagrant-disksize

and then add a line like this to your vagrantfile: config.disksize.size = '60GB'

I was having the same problem and this was the solution for me.

actually this plugin https://github.com/sprotheroe/vagrant-disksize, says

The plugin only works with VirtualBox but it will issue an error message and then disable itself if you try to use it with another provider.

and this issue is for Parallels provider. So it can't and doesn't work.

maxexcloo commented 5 months ago

Having this issue also, wondering if anyone found any fixes?

mromero-convoso commented 2 months ago

Also having this issue. Any way to get a similar 'vagrant-disksize' plugin for Parallels provider types?