2

I have a VirtualBox guest OS drive formatted as HFS+ which is 20GB. I resized it's hard disk virtual media vdi file to 40GB and now want to reduce it to 32GB.

The extra 20GB I added to the vdi with the Virtual Media Manager has never been used by the guest OS and is not visible to it.

I've tried using:

VBoxManage modifymedium disk myhd.vdi --compact

...which completes successfully but does not shrink the vdi and...

VBoxManage modifyhd myhd.vdi --resize 32768

which produces the error...

0%...
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage.exe: error: Failed to resize medium
VBoxManage.exe: error: Shrinking is not yet supported for medium 'C:\Users\me\VirtualBox VMs\Snow Leopard\Snow Leopard.vdi'
VBoxManage.exe: error: Details: code VBOX_E_NOT_SUPPORTED (0x80bb0009), component MediumWrap, interface IMedium
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleModifyMedium(struct HandlerArg *)" at line 768 of file VBoxManageDisk.cpp

Is there any way to shrink a VirtualBox vdi with a (OSX) HFS+ guest or migrate the guest hard disk to a new 20GB or 32GB vdi?

0

1 Answer 1

2

This error occurs because the Format variant of the image is fixed default. But you can only resize dynamic default.

Issue following command to check your VM's format variant:

VBoxManage showhdinfo "c:\Dev\VMs\ubuntu18.04\18.04_ubuntu.vdi"

You get following output (yours would have different values):

UUID:           57ce025b-f7e6-3435-8417-3453634535
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       c:\Dev\VMs\ubuntu18.04\18.04_ubuntu.vdi
Storage format: VDI
Format variant: fixed default
Capacity:       10240 MBytes
Size on disk:   9617 MBytes
Encryption:     disabled

If you see fixed default you must first clone the image with following command:

VBoxManage clonehd c:\Dev\VMs\ubuntu18.04\18.04_ubuntu.vdi "new-image-name".vdi

This creates a new image file "new-image-name".vdi which has dynamic default as Format variant. That one can then be resized.

1
  • Thanks, when I examine the virtual media file in VirtualBox's Virtual Media Manager it is listed as Storage Details: Dynamically allocated storage confirming it is already a dynamic disk. It's a while ago now but if I remember correctly I found dynamic disks can not be shrunk when the contained hard drive is formatted as HFS+. Commented Mar 21, 2019 at 8:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .