VDI unusable after resize

This is for discussing general topics about how to use VirtualBox.
Post Reply
sch
Posts: 2
Joined: 10. Sep 2012, 09:19

VDI unusable after resize

Post 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
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: VDI unusable after resize

Post 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.
AnotherLife
Posts: 29
Joined: 9. Sep 2012, 00:46

Re: VDI unusable after resize

Post 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 ? :?
ChipMcK
Volunteer
Posts: 1095
Joined: 20. May 2009, 02:17
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Windows, OSX
Location: U S of A

Re: VDI unusable after resize

Post by ChipMcK »

AnotherLife wrote:2TB
sch wrote:

Code: Select all

 --resize 25000000 
25,000,000 does not approximate 2TB
Twisted Lucidity
Posts: 168
Joined: 18. Feb 2012, 12:42
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Various GNU/Linux
Location: Here
Contact:

Re: VDI unusable after resize

Post 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).
A new account for an old user.
sch
Posts: 2
Joined: 10. Sep 2012, 09:19

Re: VDI unusable after resize

Post 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.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: VDI unusable after resize

Post 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.
Leak
Posts: 242
Joined: 31. Mar 2009, 13:00
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Debian Testing, Windows XP, Windows Server 2003/2008 R2

Re: VDI unusable after resize

Post 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...
AnotherLife
Posts: 29
Joined: 9. Sep 2012, 00:46

Re: VDI unusable after resize

Post 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".
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: VDI unusable after resize

Post by mpack »

Please take this discussion elsewhere. Don't hijack the OPs thread.
Post Reply