Page 1 of 1
Editing Snapshot files - parent relationship broken
Posted: 22. Nov 2010, 18:31
by ambleside
My drive crashed and my backup had multiple snapshots to a critical vm. I have 100% of the files recovered but have been frustrated piecing it together.
Here is a snippet of my VirtualBox.xml:
<HardDisk uuid="{bb550e2f-a00a-4035-9a8b-ad0295c0a39c}" location="/media/old_ubuntu/home/aaron/.VirtualBox/HardDisks/Crestron.vdi" format="VDI" type="Normal">
<HardDisk uuid="{17cab368-3d41-468a-bc74-77056e875d6f}" location="/media/old_ubuntu/home/aaron/.VirtualBox/Machines/Crestron/Snapshots/{17cab368-3d41-468a-bc74-77056e875d6f}.vdi" format="VDI">
<HardDisk uuid="{35691372-409a-494e-a8c6-e1193216fc56}" location="/media/old_ubuntu/home/aaron/.VirtualBox/Machines/Crestron/Snapshots/{35691372-409a-494e-a8c6-e1193216fc56}.vdi" format="VDI">
<HardDisk uuid="{dca043f1-3601-4456-9219-d649980bfcb1}" location="/media/old_ubuntu/home/aaron/.VirtualBox/Machines/Crestron/Snapshots/{dca043f1-3601-4456-9219-d649980bfcb1}.vdi" format="VDI">
<HardDisk uuid="{cde39fbe-ea6a-41fa-a413-07bf35838d41}" location="/media/old_ubuntu/home/aaron/.VirtualBox/Machines/Crestron/Snapshots/{cde39fbe-ea6a-41fa-a413-07bf35838d41}.vdi" format="VDI"/>
</HardDisk>
The primary and the lower 3 snapshots load fine but the 1st snapshot has an issue.
It's pointing at the UUID of the "old" primary disk. If I put that in as the UUID, I get an error. If I change the link to refer to the old UUID in the XML file, then it can't be seen. I'm happy to use a hex editor on the snapshot but a file search finds neither the old nor new UUID as plaintext in the file!
If I just take the entire old .VirtualBox director and change the paths but leave the files completely alone, virtualbox doesn't even run.
HELP!
Re: Editing Snapshot files - parent relationship broken
Posted: 22. Nov 2010, 18:42
by mpack
Before I go further, please don't say things like "when I do x, I get an error". Please be explicit about any error messages seen, screenshots would be good.
There are two practical ways to repair a broken snapshot chain. One is to recreate a VM containing an identical number of snapshots, then edit the UUIDs in the xmls. There are many ways to get this wrong and I do not recommend it.
The other way is to clone the latest (current state) VDI file, producing a merged VDI which you can then mount in a new VM (being careful to get all hardware settings identical to the old, paying particular attention to IDE controller type, MAC address and IO APIC setting). You cannot produce the clone with VBoxManage because the latter requires an intact VirtualBox.xml file. Instead you would need to download the CloneVDI tool (from the sticky in "Windows Hosts") and read its release notes which include info on recovering from your problem. As a Win32 app you will need Wine to run this on your Ubuntu host.
Incidentally: if your snapshot collection is not a true matched set then there is absolutely nothing which can be done to recover the data.
Finally, I don't want to preach, but snapshots are inherently fragile for many reasons including the one you have discovered - i.e. that taking useful backups is a problem. IMHO anyone with any sense quickly learns that snapshots are a bad idea: use clones instead when you want to freeze a point in time.
Re: Editing Snapshot files - parent relationship broken
Posted: 22. Nov 2010, 19:47
by ambleside
mpack wrote:Before I go further, please don't say things like "when I do x, I get an error". Please be explicit about any error messages seen, screenshots would be good.
There are two practical ways to repair a broken snapshot chain. One is to recreate a VM containing an identical number of snapshots, then edit the UUIDs in the xmls. There are many ways to get this wrong and I do not recommend it.
The other way is to clone the latest (current state) VDI file, producing a merged VDI which you can then mount in a new VM (being careful to get all hardware settings identical to the old, paying particular attention to IDE controller type, MAC address and IO APIC setting). You cannot produce the clone with VBoxManage because the latter requires an intact VirtualBox.xml file. Instead you would need to download the CloneVDI tool (from the sticky in "Windows Hosts") and read its release notes which include info on recovering from your problem. As a Win32 app you will need Wine to run this on your Ubuntu host.
Incidentally: if your snapshot collection is not a true matched set then there is absolutely nothing which can be done to recover the data.
Finally, I don't want to preach, but snapshots are inherently fragile for many reasons including the one you have discovered - i.e. that taking useful backups is a problem. IMHO anyone with any sense quickly learns that snapshots are a bad idea: use clones instead when you want to freeze a point in time.
Thanks. I'm surprised that the XML option didn't work. I did all that editing and it failed. I'll install Windows and try the Clone tool.
Re: Editing Snapshot files - parent relationship broken
Posted: 22. Nov 2010, 20:33
by ambleside
Here is the error I'm getting.
I did use the CloneVDI tool (CLI) to make the new main VDI. I have the entire chain intact but the lead snapshot refers to the old UUID, not the new one. Where is the Parent UUID of the vdi file stored?
Re: Editing Snapshot files - parent relationship broken
Posted: 22. Nov 2010, 21:53
by mpack
Like the other UUIDs, the "UUID of the parent" is embedded in the VDI file header. The VirtualBox.xml file allows VirtualBox to look up a filename given UUID (or vice versa of course), and the nesting of media registry entries is supposed to represent the snapshot hierarchy - but the actual relationship between elements of the chain is defined by the VDI headers. A snapshot hierarchy (which means more than just the VDI chain) is also represented in VM's xml file. I expect that any mismatch between these will cause an error message.
Re: Editing Snapshot files - parent relationship broken
Posted: 26. Nov 2010, 20:29
by heddie
hi mpack,
I needed to clone a vdi file. Tried the vboxmanager command line, crapped out @ 80%. found ur little executable, worked wonderfully. thank you.
rgds
Re: Editing Snapshot files - parent relationship broken
Posted: 26. Nov 2010, 22:40
by mpack
Hi Heddie. Thank you for the complement. I didn't want to ignore you but I'm also painfully aware that discussion of
CloneVDI is off-topic here. If you ever need to discuss it then there's a dedicated area as a
sticky in the "Windows Hosts" forum.
Re: Editing Snapshot files - parent relationship broken
Posted: 20. Sep 2011, 22:38
by equake
I also need this to work for a problem I have with snapshots on V4. Is there a way to do this?