VBOX_E_NOT_SUPPORTED during resize VirtualBox vdi file

It’s common and surley wellknown, that even virtual hard drives are getting full. So in my case, too. In case of VirtualBox (here in Version 7), at first, I executed following commands (you could use the GUI-Tools in the library, too):

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyhd "D:\VirtualBox VMs\Windows\Windows 10\Windows.vdi" --resize 40960

So, I tried with modifyhd and the –resize-Switch a resize of the .vdi-File from 30 th 40 GB. At first i got the error:

0%…VBOX_E_NOT_SUPPORTED
VBoxManage.exe: error: Failed to resize medium
VBoxManage.exe: error: Resizing to new size 41943040000 is not yet supported for medium ‚D:\VirtualBox VMs\Windows\Windows 10\Windows.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 937 of file VBoxManageDisk.cpp.

Then i created a clone with:

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe clonehd "D:\VirtualBox VMs\Windows\Windows 10\Windows.vdi" "D:\VirtualBox VMs\Windows 10\Windows_clone.vdi" --format VDI

That did a really long time, about 1 hour. Then, i tried again with the cloned file:

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyhd „D:\VirtualBox VMs\Windows\Windows 10\Windows.vdi“ –resize 40960

It works. Fine! Then i created a new machine, copied the cloned file to the new folder and added it to the library for linking it to the new machine.

Maybe, if yout try to link the cloned drive to the existing machine, there could be a error like:

UUID {b89365f9-848b-454f-8799-1f3d1d351aba} of the medium ‚D:\VirtualBox VMs\Windows \Windows 10\Windows 10.vdi‘ does not match the value {af29171e-6665-4752-bc32-d0a0799e94e8} stored in the media registry (‚C:\Users\user123.VirtualBox\VirtualBox.xml‘).
Result Code:
E_FAIL (0x80004005)
Component:
MediumWrap
Interface:
IMedium {7d510820-a678-4730-a862-818dcd3fbed0}

So, a new machine was the solution in this case. After this, i moved partitions with GParged-Live-Image and resized the C:-Main partition.