Page 1 of 1

Recover from snapshot

Posted: 12. May 2009, 18:59
by plux
Hello everyone,
A harddrive of mine recently crashed and I wonder if I could recover my virtual machine from a snapshot?
The thing is that I have a snapshot of the machine saved, but the original .vdi is lost because it happened to be on the drive that crashed.
Is there anyway I can recover data or even possible use the snapshot as a virtual machine in vbox?
I should also note that i have my old .VirtualBox dir intact with the xml-files etc.
I've tried to mount the snapshot .vdi file using vdfuse, but all I got from it was:

Code: Select all

ERROR: opening vbox image failed
When I try to load the snapshot vdi as a harddrive in virtualbox it tells me this:

Code: Select all

ERROR: Parent hard disk with UUID {<UUID>} of the hard disk {<UUID2>} is not found virtualbox.
Do you guys have any idea if I could use my snapshot to recover files from the machine?

BTW, my host OS is Ubuntu 9.04 and the guest OS is Windows XP.

I really hope you can help me! :)

Re: Recover from snapshot

Posted: 12. May 2009, 19:25
by Perryg
The closest thing that I could find http://forums.virtualbox.org/viewtopic. ... 37&start=0

You can also try to recreate the original VM (new) and then put the (saved) snapshot in the new Snapshot folder then edit the .virtualbox.xml and the machine.xml files to use the snapshot and then save the state. It is a long and drawn out process but should be doable.

Re: Recover from snapshot

Posted: 12. May 2009, 22:26
by plux
Hey,
I tried what you said. Basically I created a new machine and edited the xml files to use my old snapshot.
But the new machine can't use the old snap shot, when i try to add it to the drive I get this error:
Image

Any idea how to proceed?
I'll attach the .xml files.

Re: Recover from snapshot

Posted: 12. May 2009, 22:38
by Perryg
That is the part where I told you that you would need to edit the virtualbox.xml file.

<HardDisk uuid="{c45d7d81-cebb-4161-8d28-4b16d399305d}" location="/media/disk/vbox/winxp2.vdi" format="VDI" type="Normal">
<HardDisk uuid="{854fd3e8-a57d-47e0-a540-2f4d84a2fd1c}" location="/home/plux/.VirtualBox/Machines/winxp2/Snapshots/{854fd3e8-a57d-47e0-a540-2f4d84a2fd1c}.vdi" format="VDI"/>

Replace the one in red above with the one in your screen shot

If everything is equal it should open. If not you will need to play with the settings.

You also may need to change the uuid for the main hard drive to match the snapshoot. I only did this once (so a little fuzzy) and then never failed to backup my files since. Way too much of a hassle.

Re: Recover from snapshot

Posted: 12. May 2009, 22:59
by plux
Ok, now I get this error when trying to start the machine:
Image

Not sure where UUID {65871a9d-b638-4c48-82ba-ee55cc368f27} comes from, but my guess is that it's stored in the snapshot vdi?

Re: Recover from snapshot

Posted: 12. May 2009, 23:10
by Perryg
There are 3 uuids that have to match. they are in virtualbox.xml, the actual machine.xml and the snapshot . Since the snapshot is not changeable you need to change the other two to match. Case is sensitive and everything must match perfectly. You just need to mess with it until you get everything as it needs to be.

Re: Recover from snapshot

Posted: 12. May 2009, 23:19
by plux
Thanks for having patience with me..
I figured out the problem probably is that the UUID {c45d7d81-cebb-4161-8d28-4b16d399305d} is stored in winxp2.vdi also, and I don't quite understand how to convince virtualbox it is actually the parent disk with UUID {65871a9d-b638-4c48-82ba-ee55cc368f27} stored in the snapshot vdi.
I'll attach my latest xml files aswell.

Re: Recover from snapshot

Posted: 12. May 2009, 23:55
by Perryg
Man I don't know. I just had to do a lot of messing around with it. Using settings editing xml and using the CLI VBoxManage on it until I got it to work. As I said it was a pain and I will never let myself go there again. I back everything that is important up. Just keep on tying and hopefully it will work for you. If not I don't know what else to tell you, sorry.