[Solved] Clonehd error "Failed to clone medium"

Discussions related to using VirtualBox on Windows hosts.
Post Reply
rgleason
Posts: 13
Joined: 9. Nov 2018, 03:47

[Solved] Clonehd error "Failed to clone medium"

Post by rgleason »

Win10pro host, Win10pro VM
Without knowing enough, I made the VM Hard Disk Virtual Size too big, 150gb!

GOAL: I need to make the VM HD Virtual Size smaller!

Note: The last command used at the bottom is not supported in Windows10 yet. You'll have to use EaseUS to do the final shrinking of the vdi file.

I've followed "How to compact VirtualBox's VDI file size?" https://superuser.com/questions/529149/ ... -file-size
Using disk cleanup, optimize and sdelete64 inside the VM Win10 machine. Then from within the guest VM Win10, did a standard "Windows" shutdown.
Then executed the following:

Code: Select all

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd --compact "C:\Users\Rick\VirtualBox VMs\4.99Mui-Win\4.99Mui-Win.vdi" 
Which resulted in a reduction in the actual space being used, down to 15gb. The Virtual Size of the disk is still listed at 155gb.
So then I followed "How to reduce the virtual size of the hard disk in virtualbox" https://www.bing.com/videos/search?q=ho ... ORM=VRDGAR

Following instructions to disassociate the HD in the VM and In Virtual Media Manager and then shutdown the VM and Virtual Box. Then issued this

Code: Select all

"C:\Program Files\Oracle\VirtualBox>vboxmanage.exe" clonehd "C:\Users\Rick\VirtualBox VMs\4.99Mui-Win\4.99Mui-Win.vdi" "Win.vdi" --format vdi  --variant standard
0%...
Progress state: VBOX_E_FILE_ERROR
VBoxManage.exe: error: Failed to clone medium
VBoxManage.exe: error: Could not create the clone medium 'C:\Program Files\Oracle\VirtualBox\Win.vdi'.
VBoxManage.exe: error: VDI: cannot create image 'C:\Program Files\Oracle\VirtualBox\Win.vdi' (VERR_ACCESS_DENIED)
VBoxManage.exe: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component MediumWrap, interface IMedium
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleCloneMedium(struct HandlerArg *)" at line 990 of file VBoxManageDisk.cpp
Do I have to do something else first?

Also, since that does not seem to work, why shouldn't I just issue this:

Code: Select all

"C:\Program Files\Oracle\VirtualBox>vboxmanage.exe" modifymedium "C:\Users\Rick\VirtualBox VMs\4.99Mui-Win\4.99Mui-Win.vdi" "Win.vdi" --resize 40000
To bring the virual size back down? (I never adjusted the disk partition in the VM Windows Hard Disk Manager.)


Is using EaseUS a reasonable way to shrink my Virtual HD Size?
https://serverfault.com/questions/77910 ... x-vdi-file
Look at the last post, He shrank his disk from 50 to 20gb.
I tried a different solution in order to shrink the VM disk (vdi), named OVdi, (OVdi has disk size of 50GB, single ntfs partition with 40GB free space).
Let's follow these steps:
  • stop the VM (poweroff)
    create a new disk (vdi) with name DVdi of desired size (20GB my case..)
    attach DVdi to the VM
    boot VM and install the utility EaseUS Backup Free
    Use the EasyUS Clone function (it clones OVdi MBR, and the ntfs partition of OVdi by shrinking to new disk DVdi)
    Detach OVdi from VM
    Check if DVdi is the first boot device for the VM
    reboot the VM
Have fun
Don't forget to delete the OVdi volume.
Following these steps I successfully reduced the VM disk size from 50GB to 20GB
Last edited by rgleason on 12. Nov 2018, 03:01, edited 2 times in total.
rgleason
Posts: 13
Joined: 9. Nov 2018, 03:47

Re: Clonehd error "Failed to clone medium"

Post by rgleason »

Found
Could not create the clone medium
viewtopic.php?t=51315

Host Windows10 is 451gb and 145gb unused.
VM is 15gb actual and 155gb virtual.

I believe I am Administrator, so that isn't the problem.
rgleason
Posts: 13
Joined: 9. Nov 2018, 03:47

Re: Clonehd error "Failed to clone medium"

Post by rgleason »

Well I guess I was not Administrator!
Typed CMD in the search bar, then right clicked and picked "Administrator" and then navigated to the vboxmanage location using

Code: Select all

C:\WINDOWS\system32>cd C:\Program Files\Oracle\VirtualBox

C:\Program Files\Oracle\VirtualBox>vboxmanage.exe clonemedium disk "C:\Users\Rick\VirtualBox VMs\4.99Mui-Win\4.99Mui-Win.vdi" "Win.vdi" --format VDI  --variant Standard
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone medium created in format 'VDI'. UUID: 41acc79d-7d84-477b-9e6c-da8a1e80ace3
So next I guess I do this command, couldn't find the file of course....I did not specify the right path....what a hack I am.
Found it here. C:\Program Files\Oracle\VirtualBox\win.vid so I moved it to here C:\Users\Rick\VirtualBox VMs\Win making a new directory.
Now

Code: Select all

vboxmanage.exe modifymedium "C:\Users\Rick\VirtualBox VMs\Win\Win.vdi" --resize 40000
So now I get:

Code: Select all

C:\Program Files\Oracle\VirtualBox>vboxmanage.exe modifymedium "C:\Users\Rick\VirtualBox VMs\Win\Win.vdi" --resize 40000
0%...
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage.exe: error: Resize medium operation for this format is not implemented yet!
So I guess I will have to use EaseUs to shrink it. https://www.easeus.com/partition-manager/
Too bad That isn't clear.
rgleason
Posts: 13
Joined: 9. Nov 2018, 03:47

Re: Clonehd error "Failed to clone medium"

Post by rgleason »

After reattaching the vdi file and starting up the VM, I decided to try Cloning the "4.99Mui-Win" VM to a new name "Win10", which worked. I then exited the VM and VirtualBox and copied the Win/Win.vdi that I had cloned earlier from the command prompt, to Win10/win.vdi. Then I renamed win.vdi to win10.vdi. Then started the VirtualBox again, and highlighted the Win10 VM icon and reestablished the SATA Hard Disk link to win10/win10.vdi. Then started the Win10 VM.


I thought I would need EaseUS to shrink the volume, but when in the Win10VM with "Disk Management" screen up, a simple right click on the partition and select "Shrink Volume" and Windows calculates how much the volume can be shrunk. See screenshot. Earlier when in VirtualBox I had increased the "Virtual Hard Disk" size to "150mb" however I had not gone into the VM Disk Management to allocate that space, so an unallocated space of 100gb was still showing. After selecting to shrink Partition C from 50gb to 40gb the unallocated space increased to 110gb. So I realize that by not allocating that space, the virtual machine will never overwhelm my host Windows10.

So now I am comfortable and I consider this problem solved.
Disk Management.PNG
Disk Management.PNG (57.1 KiB) Viewed 14485 times
Post Reply