1

I was trying to resize (expand from 20GB to 40GB) a VHD containing a Ubuntu instance using VirtualBox's vboxmanage tool:

./vboxmanage modifyhd path-to-my.vhd --resize 40000

However, it seemed like stuck on 0% (I previously expanded from 10GB to 20GB and it completed instantly) so I force quitted the process. Now, my VHD is corrupted, VirtualBox can't start the instance (telling that VHD is corrupted), I've also tried Windows' Disk Management and it can't attach either (I get "Parameter is incorrect" error).

I also tried resizing it back to the original size (20000):

./vboxmanage modifyhd path-to-my.vhd --resize 20000

But I got:

VBoxManage: error: Error: Attempt to resize the medium from 0.0 MB to 20000.0 MB. Use --resizebyte if this is intended!

I've also tried --resizebyte option:

./vboxmanage modifyhd path-to-my.vhd --resizebyte 20000

VBoxManage: error: Code NS_ERROR_ABORT (0x80004004) - Operation aborted (extended info not available)
VBoxManage: error: Context: "Resize(cbResize, pProgress.asOutParam())" at line 762 of file VBoxManageDisk.cpp
VBoxManage: error: Failed to resize medium!

Is there any way to fix it (e.g. forcing VHD to reporting its size as 20000GB as before, instead of 0 bytes)? The VHD file itself is currently 28.66GB on disk, if it helps.

I know what I did was completely dumb, but is there any way to get my image back?

2
  • To my understanding, vboxmanage creates a new file with the data, then once the new file is created, the old file is removed and replaced with the newly created file. Do you see 2 files?
    – LPChip
    Commented Mar 14, 2019 at 10:42
  • @LPChip nope, there's only a single VHD file, which is corrupted. Commented Mar 14, 2019 at 10:54

0

You must log in to answer this question.

Browse other questions tagged .