Page 1 of 1

Reattach VM with Snapshots

Posted: 11. Sep 2009, 02:12
by mrbmason
Hi,
I have searched around for an answer to my problem and I think I am going to be out of luck, but here goes.

I was running vbox 3.0.6 on ubuntu 8.04 host and a vista guest. My host os got all messed up and I had to reinstall.
So I now have unbuntu 9.04 and my vbox vista guest files are all still entact (they were on a separate partition).
My vista guest had 3 or 4 snapshots as I was building it.
I was suprised to find out that I cannot just reattach to the vm xml file and bring my image back to life.
I have attahced to the vdi in the hard disk directory, but the guest is in the original snapshot state (which is the base vista load).
How can I reattach my vm with all of it's snapshots and get back to the fully loaded state that it was in?

Thanks,

Brian

Re: Reattach VM with Snapshots

Posted: 11. Sep 2009, 02:45
by Perryg
If you still have the original virtualbox.xml and the machine.xml it might be possible. You have to install Virtualbox in the same location as before and then edit the new *.xml's to have the original *.xml information.
Keep backups of these as it may take a few attempts to make it happen.

Re: Reattach VM with Snapshots

Posted: 11. Sep 2009, 04:24
by mrbmason
Thanks for the reply, I figured it out and was able to fully recover. I did have the Machines and HardDrives directories and all of their data, the only thing that I was missing was the glue to put them together and register them with VBox. The glue is contained in the VirtualBox.xml file located in the .VirtualBox hidden folder in my home directory. Here are my steps to fix the problem:
1. I made a copy of my vdi file and the Machines directory VM folder (in my case called vistadev) and then renamed the vistadev to vistdev1. The VM folder had all of the snapshot vdi files in it.
2. I Created a new VM called vistadev and pointed to my vdi file. That did boot and it brought up the system at the fisrt snapshot.
3. I then created as many snapshots as I had in my real system (in my case 4).
4. Then I shut down vbox and renamed the new vistadev VM folder to vistadevnew.
5. Then I renamed vistadev1 (the system I wanted to recover) to vistadev.
6. I then opened the vistadev.xml from my vistadev machine folder.
7. I then opened VirtualBox.xml with a text editor. I changed the following things
- changed the MachineEntry uuid to match the uuid from the vistadev.xml
- changed the HardDisk uuid's to match the SnapShot.StorageControllers.StorageController.AttachedDevice.Image uuid. This uuid matches up the the vdi files stored in the vistadev/Snapshots folder. You just need to line things up properly.

The reason I created a fake one first with the same number of snapshots it to make it easy to edit the VirtualBox.xml file so that I would get the proper xml containment syntax.

Not too bad. I went from a very scary situation to back in business.

Note: I did have a dvd pointing to an iso image in some of the snapshots, but that was easily over come by just deleting the uuid under the dvd tag.

Re: Reattach VM with Snapshots

Posted: 11. Sep 2009, 04:31
by Perryg
Glad you figured it all out. Just remember that the xml files are something that you need to backup as well as the vdi files and all will be good.