Page 1 of 2

[Solved] Vboxmanage modifymedium: --resize bug?

PostPosted: 21. Jan 2017, 03:44
by Vilnth
Hey guys! New to VirtualBox, was getting pretty frustrated trying to resize a virtual disk using the vboxmanageutility and wondering if I am doing something wrong or if this might be a bug.

Host: Windows 10 Pro (x64)
Guest: Windows Server 2016
Virtualbox: 5.1.14 r112924 (Qt5.6.2)

Basically, I had a 20GB dynamic .vhd file that was filling up rather quickly, so I wanted to increase the size to 30GB. However, I quickly ran into a problem where the modifymedium command would immediately generate an error and not complete. This persisted across normal and admin command prompts, and survived both a host restart and a repair reinstall of Virtualbox. Eventually, I did achieve the desired result with in the following sequence:

Code: Select all   Expand viewCollapse view
C:\Program Files\Oracle\VirtualBox>vboxmanage modifymedium C:\_dev\vm\Magus\Magus.vdi --resize 30720
VBoxManage.exe: error: Error: Attempt to resize the medium from 0.0 MB to 30720.0 MB. Use --resizebyte if this is intended!

C:\Program Files\Oracle\VirtualBox>vboxmanage modifymedium C:\_dev\vm\Magus\Magus.vdi --resizebyte 30720000000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%


Note: The second operation not exactly the 30 GB I had envisioned, but I was frustrated and just wanted to throw enough 0's after my original input to pass as a parameter. Thankfully, it was successful!

Anyway, I was thinking maybe the sanity check that got added to the --resize flag in the latest available version might be getting triggered incorrectly? Based on the current documentation, I'm not seeing what else might be going on with my input...

Re: Vboxmanage modifymedium: --resize bug?

PostPosted: 21. Jan 2017, 12:27
by mpack
It certainly does look like a bug with the new sanity check feature. For some reason it seems to think that the old VHD is 0MB in size.

Speaking of which: frankly, you shouldn't be using VHD, as that is an alien format. IMHO if you choose VHD then my sympathies for the many things that can go wrong are somewhat limited.

[Edit] Belay that. I made the mistake of accepting what you wrote, and not noticing that the filename contradicted you. You said you had a .vhd, the command line filename you provided says .vdi. Which is it? Because if it's a VHD with a .VDI extension then that is certainly asking for trouble.

p.s. FYI, 30GB is 30*(1024^3)==32212254720 bytes.

Re: Vboxmanage modifymedium: --resize bug?

PostPosted: 21. Jan 2017, 19:34
by Vilnth
My bad, the original disk attached to my VM was a VHD, but I had cloned it to a VDI to test the same command and it still wasn't working.

Good catch though! My first few guests were created as VHD for portability, to possibly test with Hyper V alongside Virtual Box. At this point though, due to storage issues I've pretty much cloned and converted everything to VDI.

Re: Vboxmanage modifymedium: --resize bug?

PostPosted: 23. Jan 2017, 19:03
by frank
I would like to see the output of

Code: Select all   Expand viewCollapse view
VBoxManage showhdinfo C:\_dev\vm\Magus\Magus.vdi
.

Re: Vboxmanage modifymedium: --resize bug?

PostPosted: 23. Jan 2017, 19:07
by mpack
Hi Frank, if you wanted to see the disk size, note that the OP says in his first post that he successfully used --resizebytes, so the drive size will be 30GB (ish). No easy way to know what it was before. Maybe the other occurrence would provide better info.

@Vilith: please don't let my post stop you from providing the info Frank is asking for. I imagine it would still be nice to see proof of the container format.

Re: Vboxmanage modifymedium: --resize bug?

PostPosted: 25. Jan 2017, 18:56
by Vilnth
The original disk (.VHD) had a size of 20GB when it was created through the VirtualBox GUI.

Code: Select all   Expand viewCollapse view
C:\Program Files\Oracle\VirtualBox>vboxmanage showhdinfo C:\_dev\vm\Magus\Magus.vdi
UUID:           e03bfb6b-4324-4893-9842-7b5ffbd71e81
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       C:\_dev\vm\Magus\Magus.vdi
Storage format: VDI
Format variant: dynamic default
Capacity:       29296 MBytes
Size on disk:   28913 MBytes
Encryption:     disabled
In use by VMs:  Magus (UUID: 6a32ec9b-d52a-4eab-a58c-a18297daf079)

Re: Vboxmanage modifymedium: --resize bug?

PostPosted: 27. Jan 2017, 12:29
by Knoll42
Any update on this at all please? I have exactly the same issue.
Code: Select all   Expand viewCollapse view
E:\KCI-VBOX-WK8VM\KCI-VBOX-W2K8>VBoxManage showhdinfo E:\KCI-VBOX-WK8VM\KCI-W2K8\KCI-VBOX-W2K8.vdi
UUID:           5f75a303-1689-4ea3-960d-478fdd3b1578
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       E:\KCI-VBOX-WK8VM\KCI-VBOX-W2K8\KCI-VBOX-W2K8.vdi
Storage format: VDI
Format variant: dynamic default
Capacity:       53480 MBytes
Size on disk:   53118 MBytes
Encryption:     disabled
In use by VMs:  KCI-VBOX-W2K8 (UUID: 96368daa-3e60-44f1-b9f2-c01376d0ea30)

Re: Vboxmanage modifymedium: --resize bug?

PostPosted: 27. Jan 2017, 13:43
by socratis
@Knoll42
Please define "I have exactly the same issue". What are the exact command input and output?

Re: Vboxmanage modifymedium: --resize bug?

PostPosted: 27. Jan 2017, 17:09
by mpack
If you have the OPs problem then the OP's first post already documents the workaround: use "--resizebytes" until there is a new maintenance release, which will probably happen in a month or so.

The good news is that the bug is reported as fixed in ticket #16311 (correct from VBox 5.1.16).

Re: Vboxmanage modifymedium: --resize bug?

PostPosted: 23. Feb 2017, 00:32
by stefgosselin
Same issue here. Any idea when next release is out that fixes this?

Thanks!

Re: Vboxmanage modifymedium: --resize bug?

PostPosted: 23. Feb 2017, 00:37
by socratis
Unless you're a VirtualBox developer, nobody knows. Post a comment to the ticket if you want to get notifications. Plus, you know about the "--resizebytes" workaround, right?

Re: Vboxmanage modifymedium: --resize bug?

PostPosted: 3. Mar 2017, 06:26
by ashm314
I have the same issue.
I've tried and got error message
a) --resize 33792
>> VBoxManage.exe: error: Error: Attempt to resize the medium from 0.0 MB to 33792.0 MB.
Use --resizebyte if this is intended!
b) --resizebyte 34603008
>> VBoxManage.exe: error: Resize medium operation for this format is not implemented yet!

my environment:
Windows 10 Pro (64-bit) version 1607, Build 14393.693
Windows 7 Ultimate (64-bit)
VirtualBox : 5.1.14 r112924 (Qt5.6.2)

I'm afraid it's a bug in VirtualBox.
With the older version of VirtualBox, I could resize the size of virtual machines. I cannot remember their version...

Re: Vboxmanage modifymedium: --resize bug?

PostPosted: 3. Mar 2017, 07:57
by socratis
ashm314 wrote:I'm afraid it's a bug in VirtualBox.

You didn't read the thread, did you? At all...
mpack wrote:It certainly does look like a bug with the new sanity check feature.
mpack wrote:The good news is that the bug is reported as fixed in ticket #16311.
socratis wrote:you know about the "--resizebytes" workaround, right?

Re: Vboxmanage modifymedium: --resize bug?

PostPosted: 3. Mar 2017, 10:30
by ashm314
Your guess is right. I have not read all threads thoroughly.

I'm a software developer, and published a work that can modify VM's storage size with GUI, without command line.
And a user told me he could not resize(expand) the storage size, and I've just noticed the issue.

Sorry, if my thread would be some noise to you.

Re: Vboxmanage modifymedium: --resize bug?

PostPosted: 3. Mar 2017, 10:39
by socratis
ashm314 wrote:I'm a software developer, and published a work that can modify VM's storage size with GUI, without command line.
That sounds interesting... Is there a link or a website? Since you're new, the spam filters won't let you post a URL, so if you can, obfuscate it, like "www . virtualbox . org /wiki/Downloads".