VDI unusable after resize

This is for discussing general topics about how to use VirtualBox.

VDI unusable after resize

Postby sch » 10. Sep 2012, 09:56

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   Expand viewCollapse view
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
sch
 
Posts: 2
Joined: 10. Sep 2012, 09:19

Re: VDI unusable after resize

Postby mpack » 10. Sep 2012, 12:04

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

Re: VDI unusable after resize

Postby AnotherLife » 10. Sep 2012, 17:06

That's why I export backups every two days.

Why does it allow sizes >2TB anyway, how difficult is a simple sanity check ? :?
AnotherLife
 
Posts: 29
Joined: 9. Sep 2012, 00:46

Re: VDI unusable after resize

Postby ChipMcK » 11. Sep 2012, 02:26

AnotherLife wrote:2TB
sch wrote:
Code: Select all   Expand viewCollapse view
 --resize 25000000
25,000,000 does not approximate 2TB
ChipMcK
Volunteer
 
Posts: 1096
Joined: 20. May 2009, 02:17
Location: U S of A
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Windows, OSX

Re: VDI unusable after resize

Postby Twisted Lucidity » 11. Sep 2012, 09:08

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.
Twisted Lucidity
 
Posts: 165
Joined: 18. Feb 2012, 12:42
Location: Here
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Various GNU/Linux

Re: VDI unusable after resize

Postby sch » 11. Sep 2012, 15:09

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 https://forums.virtualbox.org/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.
sch
 
Posts: 2
Joined: 10. Sep 2012, 09:19

Re: VDI unusable after resize

Postby mpack » 11. Sep 2012, 15:24

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

Re: VDI unusable after resize

Postby Leak » 11. Sep 2012, 17:58

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...
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

Postby AnotherLife » 30. Sep 2012, 04:41

ChipMcK wrote:
AnotherLife wrote:2TB
sch wrote:
Code: Select all   Expand viewCollapse view
 --resize 25000000
25,000,000 does not approximate 2TB

I typed >2TB.

Notice that weird symbol ? It means "bigger than".
AnotherLife
 
Posts: 29
Joined: 9. Sep 2012, 00:46

Re: VDI unusable after resize

Postby mpack » 30. Sep 2012, 11:18

Please take this discussion elsewhere. Don't hijack the OPs thread.
mpack
Site Moderator
 
Posts: 28397
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP


Return to Using VirtualBox

Who is online

Users browsing this forum: No registered users and 7 guests