Snapshot merge crashed mid way through. What to do?

This is for discussing general topics about how to use VirtualBox.
Post Reply
mchl_nix
Posts: 2
Joined: 19. Dec 2018, 13:29

Snapshot merge crashed mid way through. What to do?

Post by mchl_nix »

I have a VM with two hard drives connected.

Using this setup I made 7 snapshots and wanted to delete the third one.

During the merge process `VBoxSvc` crashed leaving me with one (hopefully successfully) merged Hard Drive 2, one unmerged Hard Drive 1 and a VM, that is still listing the Snapshot as present.
  • I can't delete the Snapshot again, because Hard Drive 2 is missing the related snapshot-vdi now.

    I can't use Hard Drive 2, because the VM think it needs the removed snapshot-vdi for that.
Is it possible, to merge Hard Drive 1 in the same way Hard Drive 2 was, then manually edit the .vbox file to remove the Snapshot from it and therefore complete the Snapshot-Removal process?

Screenshots: https://imgur.com/a/zmH6LSM
mchl_nix
Posts: 2
Joined: 19. Dec 2018, 13:29

Re: Snapshot merge crashed mid way through. What to do?

Post by mchl_nix »

I think I solved the problem using the following procedure:

VM name: Workbench64
Complete Hard Drive with snapshot parts: HDD1
Already Merged Hard Drive without that particular snapshot part: HDD2
  1. I backed up the vm directory of Workbench64, in case of further damage
  2. I checked the broken snapshot in the VBox Gui to find out the UUID of the missing vdi-part, by right clicking it and selecting "Snapshot details".
    In case an attached storage device is not accessible its UUID will be shown in bold. Mine was "{5c95...}"
  3. I closed the VBox Gui, so that it wouldn't override the Workbench64.vbox file.
  4. I moved the HDD2.vdi file out of the Workbench64 VM directory. (maybe unnecessary)
  5. I opened the Workbench64.vbox in a text editor and searched for occurrences of "{5c95...}" (the entire UUID, obviously).
    The first occurrence is in the "<HardDisks> section. It will look something like this:

    Code: Select all

    <HardDisk uuid="{5c95...}" location="Snapshots/{5c95...}.vdi" format="VDI">
    If there is a "/>" at the end, just delete that entire line. If there is no "/>" at the end, like in my example, delete the entire line and one "</HardDisk>" below (which one shouldn't matter, but to be extra sure, use the one that has the same level of indentation (spaces in front) as the line you deleted).
  6. The next occurrence should be in a "<Image>" tag similar to this:

    Code: Select all

    <AttachedDevice type="HardDisk" hotpluggable="false" port="0" device=0">
      <Image uuid="{5c95...}" />
    </AttachedDevice">
    Delete the "<Image>" and the surrounding "<AttachedDevice>[...]</AttachedDevice>" tag. Only of the UUID you are searching for, leave the other ones alone!)
    This will remove the missing snapshot vdi-part from the VM-Snapshot.
  7. Save the file and quit your text editor.
  8. Open the VBox Gui and check the details of the Snapshot in your VM again to see, if it is still complaining about a missing vdi-part. (It shouldn't.)
  9. Try deleting/merging the snapshot now. It should merge the vdi-part of (in my case) HDD1 into it and remove the Snapshot from the VM.
If everything worked out you now have HDD1 merged as well and a VM without the broken snapshot. Move HDD2.vdi back into the VM folder if you followed step 4 and it should boot into the latest state/snapshot you have on that VM.

I don't seem to have lost any data, since the Snapshot merge crashed in between the actual merging, so maybe I was just lucky. Hope this helps people with similar problems.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Snapshot merge crashed mid way through. What to do?

Post by mpack »

You got very lucky. A much better solution is to stop using snapshots altogether. Instead use real backups, which are proof against all kinds of failures that snapshots cater for, and many others that they cannot, such as total host disk failure. Plus true backups require no additional disk space on the host.
Post Reply