Page 1 of 1

VDI unusable after resize

Posted: 10. Sep 2012, 09:56
by sch
Hi,

I run VirtualBox 4.1.12_Ubuntu R77245.
I have a virtual machine under Windows 7 on a 20 GB virtual disk (dynamic VDI file).
I wanted to resize my virtual disk to 25 GB but I typed :

Code: Select all

VBoxManage modifyhd sch01.vdi --resize 25000000
The virtual machine doesn't work any more.
It is not possible to resize with a shorter value.
Of course, I have no backup...
I have tried to repair with the Windows CD on a copy of the VDI file but it didn't worked.
I have also tried with qparted-live-0.13.1-2 : it sees the 2 partitions but in fstype RAW. I have changed it to NTFS but it didn't worked.
I have tried to copy the 2 partitions to a new 20 GB VDI file but it didn't worked.
I installed a new Windows on a 20 GB VDI file and then copied the 512 first bytes (MBR) to the one with my data but it didn't worked.

Is there a way to recover my data ?
Thanks for help.
SCH

Re: VDI unusable after resize

Posted: 10. Sep 2012, 12:04
by mpack
The additional messing about may have put the situation beyond repair, so I hope you made a backup before you did that?

In any case here is a link to a previous discussion of the subject.

Re: VDI unusable after resize

Posted: 10. Sep 2012, 17:06
by AnotherLife
That's why I export backups every two days.

Why does it allow sizes >2TB anyway, how difficult is a simple sanity check ? :?

Re: VDI unusable after resize

Posted: 11. Sep 2012, 02:26
by ChipMcK
AnotherLife wrote:2TB
sch wrote:

Code: Select all

 --resize 25000000 
25,000,000 does not approximate 2TB

Re: VDI unusable after resize

Posted: 11. Sep 2012, 09:08
by Twisted Lucidity
ChipMcK wrote:25,000,000 does not approximate 2TB
I'm guessing OP knows that, which is why they said "but I typed"

I'm also guessing that OP has learnt a valuable lesson about back-ups (either of the VDI, or of the data contained therein).

Re: VDI unusable after resize

Posted: 11. Sep 2012, 15:09
by sch
mpack : unfortunately, I have no backup before the resize command. I keep a backup of the vdi file just after the resize command and try to recover on a copy of it.
I have tried to change the 0x170: "00 00 00 84 d7 17 00 00" by "00 00 00 00 50 00 00 00" and the 0x180: "40 78 7d 01" by "00 50 00 00" bytes in the vdi file as explained in viewtopic.php?f=1&t=47354 but the partitions still show RAW filesystem type and a boot ends with "missing operating system".
I have also tried with 80 instead of 50 (60GB instead of 20GB disk size) but I still can't find a way to recover my NTFS filesystem.

Re: VDI unusable after resize

Posted: 11. Sep 2012, 15:24
by mpack
I'm afraid there isn't much I can add to what is already mentioned. The only additional comment I would make is: please don't thrash around making changes you don't understand, you will only make matters worse, and make your problems impossible to diagnose remotely. Restore the VDI to the state of the backup - which is hopefully right after the resize which went wrong - and look to patch the header such that the new size is large enough to accomodate the partition(s) that were already present on the drive. There is no value in trying multiple different sizes.

Alternatively, if the VM still boots from a CD, you can try the idea of imaging the disk from a live CD containing CloneZilla etc. It's possible that Disk2VHD could somehow be made to work on a live CD too, but I don't know how - you would have to research that yourself. One point: the linked thread referred to a technique of dumping a raw partition image and then converting that to a complete VDI using CloneVDI: unfortunately that trick will not work for Win7, because the latter creates multiple partitions during an install, not a single bootable one.

Re: VDI unusable after resize

Posted: 11. Sep 2012, 17:58
by Leak
You might want to try attaching the VDI to a new VM, boot it from a rescue CD containing TestDisk (there's a list of live CDs on their wiki) then see if it finds anything partition-, filesystem- or file-wise...

Re: VDI unusable after resize

Posted: 30. Sep 2012, 04:41
by AnotherLife
ChipMcK wrote:
AnotherLife wrote:2TB
sch wrote:

Code: Select all

 --resize 25000000 
25,000,000 does not approximate 2TB
I typed >2TB.

Notice that weird symbol ? It means "bigger than".

Re: VDI unusable after resize

Posted: 30. Sep 2012, 11:18
by mpack
Please take this discussion elsewhere. Don't hijack the OPs thread.