Page 1 of 1

Resizing broke my Windows Server VHD

Posted: 14. Sep 2011, 20:42
by dtdono0
Hi,

I had a 20 GB VHD Windows Server 2008 image that I ended up using all the space. Did the following I saw on another post here to double the size from 20 to 40 GB:

C:\Program Files\Oracle\VirtualBox>vboxmanage modifyhd "C:\Users\test\Virtua
l Machines\Windows_Server_2008_R2_Enterprise.vhd" --resize 40000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

After running this the image in VB Manager said it was now 40 GB...great I thought! Then I proceeded to boot the image but now during the POST I get:
FATAL! No valid boot media detected.

I unfortunately did not think to make a backup before doing this...do I need to start over from scratch?

Re: Resizing broke my Windows Server VHD

Posted: 15. Sep 2011, 22:32
by Sasquatch
That just showed how important it is to make a backup of files when you're going to modify them. Was the original VHD a dynamic expanding one? This is in the manual about it:
The --resize option allows you to change the capacity of an existing image; this adjusts the logical size of a virtual disk without affecting the physical size much. This currently works only for expanding the capacity of VDI and VHD formats, and only for the dynamically allocated variants.
It doesn't work otherwise and I reckon that if it doesn't give you an error when it's fixed, you would end up with what you have now.

All that you can try is to hook it up to another VM and see if you can read any data from it and salvage what you can. You may have to start from scratch anyway, because it no longer boots. Repairing it might just as well fail.

Re: Resizing broke my Windows Server VHD

Posted: 6. Oct 2011, 01:25
by dcadiou
Hi

I also had the same kind of problem (fortunately I had backups).
I run a vboxmanage modify ... --resize command to expand an initial vhd file, at the end the new size seems correct, but the disk is now empty and the vm don't boot anymore.

I attached this vhd as a slave to another vm, and saw that this disk is empty with no partition at all.

So : Don't use this command to resize, it's a very dangerous command. It seems there is a bug in it !!!
Otherwise I don't understand why this command is still proposed by virtualbox team to user !

Re: Resizing broke my Windows Server VHD

Posted: 6. Oct 2011, 01:52
by Perryg
Strange. I use it all the time and do not have problems.
But if you are a Windows user and have problems then just use CloneVDI Tool
Linux users can use this tool in wine.

Re: Resizing broke my Windows Server VHD

Posted: 6. Oct 2011, 19:29
by Sasquatch
I think that if there is a bug, it's in the VHD support. After all, resizing of dynamic VDI files go without any problem.