sprotheroe / vagrant-disksize

Vagrant plugin to resize disks in VirtualBox
MIT License
479 stars 52 forks source link

Disk cannot be decreased in size #11

Closed robertluwang closed 5 years ago

robertluwang commented 6 years ago

I run vagrant on msys64 on win7,

$ vagrant version
Installed Version: 1.9.0

$ vagrant plugin list
vagrant-disksize (0.1.2)

Vagrantfile:

Vagrant.configure("2") do |config|
    config.disksize.size='50GB'

first time got this Permission denied,

C:/path/.vagrant.d/gems/2.2.5/gems/vagrant-disksize-0.1.2/lib/vagrant/disksize/actions.rb:47:in `delete': Permission denied @ unlink_internal

2nd time I ran msys64 as Admin so passed that permission error,then got new error,

==> k8s-master: Disk cannot be decreased in size. 51200 MB requested but disk is already 81920 MB.
papa-smurf commented 6 years ago

Are you actually trying to shrink an existing disk or is this a message you get when trying to increase disk size?

robertluwang commented 6 years ago

the existing vagrant box is 80GB, I am trying to reduce size to 50GB in Vagrantfile but failed.

papa-smurf commented 6 years ago

I now understand why the owner of this repo didn't take the time to answer your question..

Limitations At present only the first disk will be resized. That seems to be OK for typical boxes such as the official Ubuntu images for Xenial, but there may well be other configurations where the first disk found isn't the main HDD.

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.

Disks can only be increased in size. There is no facility to shrink a disk.

EDIT: @robertluwang would you mind closing this issue?

sprotheroe commented 5 years ago

This is tricky (read: time-consuming and involved) to implement in a safe way across multiple guest OSs. I agree it would be great functionality to have but, in my view, it's out of scope for this plugin. I wrote this initially as several of the standard boxes and cloud images available have pretty small default disks and are not that useful as they stand.

If someone wants to work on this functionality I'll happily accept a PR, although I think we should add a pretty big health warning in that case.