Recovering from failed snapshot delete

Discussions related to using VirtualBox on Linux hosts.
Post Reply
AngusM
Posts: 25
Joined: 13. Jun 2011, 22:45
Primary OS: openSUSE
VBox Version: OSE other
Guest OSses: WinXP

Recovering from failed snapshot delete

Post by AngusM »

I tried to delete a snapshot for a WinXP guest, but it failed. The snapshot seems to have disappeared (others remain), but now as soon as I try to start the box I am immediately told that it can't boot the medium. What's the procedure for recovery in this case? Even if I can't start the vm again, I'd at least like to be able to access the files.
For some reason, the HDD seems to have been taken off the machine. When I go to Settings|Storage, there's no HDD there. When I try to apply the vdi file to it, gives the earliest snapshot as what it is "attached" to. (I want to make use of a much later snapshot.) If I try to attach one of the snapshots to the controller, I'm told:

Code: Select all

Result Code: NS_ERROR_FAILURE (0x80004005)
Component: MediumWrap
Interface: IMedium {4afe423b-43e0-e9d0-82e8-ceb307940dda}
Callee: IVirtualBox {9570b9d5-f1a1-448a-10c5-e12f5285adad}
Callee RC: VBOX_E_OBJECT_NOT_FOUND (0x80BB0001)
The guest is WinXP 32-bit. The host is Ubuntu 16.04 AMD64 and VB 5.2.12
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Recovering from failed snapshot delete

Post by socratis »

AngusM wrote:What's the procedure for recovery in this case?
Restoring from a backup would be the safest choice at this point.

Right-click on the VM, "Show in Explorer/Finder/somethine_else?". ZIP that selected .vbox file and attach it to your reply. Also, an "ls -alR <Your_VM_folder>" as well.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
AngusM
Posts: 25
Joined: 13. Jun 2011, 22:45
Primary OS: openSUSE
VBox Version: OSE other
Guest OSses: WinXP

Re: Recovering from failed snapshot delete

Post by AngusM »

Actually, I only made a backup after the fact, in case I made something worse :( Only took 2 measly days.

Some of those files are not relevant, but I was using XP_main.vdi as my hdd.

Code: Select all

.:
total 247212232
drwxr-xr-x 4 angus users         4096 May 26 09:07 ./
drwxr-xr-x 7 angus users         4096 May 12 17:54 ../
drwxr-xr-x 2 angus users         4096 May 21 11:06 Logs/
-rw------- 1 angus users          537 Jun 13  2011 my_hdd.vmdk
drwxr-xr-x 2 angus users         4096 May 19 19:15 Snapshots/
-rwxr-xr-x 1 angus users        20992 Jun 13  2011 Thumbs.db*
-rw-rw-r-- 1 angus angus    629448704 Apr 12  2011 vc8_2.iso
-rw-r----- 1 angus angus    626825216 Aug  3  2015 vc8-KGR3T-F2C26-RRTGT-D6DQT-QBBB3.iso
-rw------- 1 angus angus        52342 Jan 30  2016 XP-1.11-linux.vbox
-rw------- 1 angus users 130292887552 Aug  3  2015 XP_main.vdi
-rw------- 1 angus users  92958134272 Aug  3  2015 XP_old_c_drive.vdi
-rw------- 1 angus angus        24859 May 21 11:08 XP.vbox
-rw------- 1 angus angus        24859 May 21 11:08 XP.vbox-prev
-rw------- 1 angus users  28637806592 Dec  3  2011 XP.vdi

./Logs:
total 736
drwxr-xr-x 2 angus users   4096 May 21 11:06 ./
drwxr-xr-x 4 angus users   4096 May 26 09:07 ../
-rw------- 1 angus angus  83874 May 21 11:08 VBox.log
-rw------- 1 angus angus 276385 May 19 19:12 VBox.log.1
-rw------- 1 angus angus  83646 May 19 19:11 VBox.log.2
-rw------- 1 angus angus 267027 May 19 19:10 VBox.log.3
-rw-rw-r-- 1 angus angus  10283 May 19 19:12 VBox.png.1
-rw-rw-r-- 1 angus angus  10282 May 19 19:10 VBox.png.3

./Snapshots:
total 9292
drwxr-xr-x 2 angus users    4096 May 19 19:15 ./
drwxr-xr-x 4 angus users    4096 May 26 09:07 ../
-rw------- 1 angus angus 7340032 May 19 19:14 {02c3c883-b19e-4fab-900d-e0be9b7744e5}.vdi
-rw------- 1 angus users  147456 Dec  3  2011 {7e39c27c-8983-41b0-849e-8ff536d9d428}.vdi
-rw------- 1 angus users 3293184 May 21 11:10 {d2b4530e-7ef3-40b4-9a6f-665c29568119}.vdi
Attachments
XP.vbox.zip
(4.03 KiB) Downloaded 11 times
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Recovering from failed snapshot delete

Post by socratis »

Facts:
  1. Only your first snapshot (2015-08-03 21:36:09Z) has any hard disks attached.
  2. You have another snapshot (2018-05-12 02:09:54Z) and finally your current state, both of which do *not* have any HDs attached.
  3. You have 3 differential VDIs (from the looks of them, can't know for sure yet), that seem "orphaned". Except a single one that's from 2011 (?!?), the other two are from a day after you've taken the last snapshot, which might indicate that they're part of the "Current State". Not sure what to make from the difference in the dates though.
  4. You have/had two HDs attached to your VM and I don't know what kind they are; normal, immutable, write-through, etc.
I'd like to see the output of the following commands (including the command itself):
  • 
    VBoxManage showmediuminfo "<Your_VM_folder>/XP_main.vdi"
    VBoxManage showmediuminfo "<Your_VM_folder>/XP_old_c_drive.vdi"
    VBoxManage showmediuminfo "<Your_VM_folder>/Snapshots/{02c3c883-b19e-4fab-900d-e0be9b7744e5}.vdi"
    VBoxManage showmediuminfo "<Your_VM_folder>/Snapshots/{7e39c27c-8983-41b0-849e-8ff536d9d428}.vdi"
    VBoxManage showmediuminfo "<Your_VM_folder>/Snapshots/{d2b4530e-7ef3-40b4-9a6f-665c29568119}.vdi"
    
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
AngusM
Posts: 25
Joined: 13. Jun 2011, 22:45
Primary OS: openSUSE
VBox Version: OSE other
Guest OSses: WinXP

Re: Recovering from failed snapshot delete

Post by AngusM »

I can tell you that I'm pretty sure I had 3 snapshots and I was trying to delete the 2nd one when it all collapsed on me.

Code: Select all

$ VBoxManage showmediuminfo "XP_main.vdi" 
UUID:           88281da0-61fb-4152-a291-d07edae13aba
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       /home/angus/VirtualBox VMs/XP/XP_main.vdi
Storage format: VDI
Format variant: dynamic default
Capacity:       256000 MBytes
Size on disk:   124256 MBytes
Encryption:     disabled
In use by VMs:  XP (UUID: a3690bf7-ac0d-4098-898d-2df013b4d9a9) [before_keygen (UUID: ba5f8e47-23e0-4715-a2f3-c2dd45b65e02)]

Code: Select all

$ VBoxManage showmediuminfo "XP_old_c_drive.vdi" 
UUID:           de7c2487-8061-4637-a96e-378228b1d5a2
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       /home/angus/VirtualBox VMs/XP/XP_old_c_drive.vdi
Storage format: VDI
Format variant: dynamic default
Capacity:       204800 MBytes
Size on disk:   88651 MBytes
Encryption:     disabled
In use by VMs:  XP (UUID: a3690bf7-ac0d-4098-898d-2df013b4d9a9) [before_keygen (UUID: ba5f8e47-23e0-4715-a2f3-c2dd45b65e02)]

Code: Select all

$ VBoxManage showmediuminfo "Snapshots/{02c3c883-b19e-4fab-900d-e0be9b7744e5}.vdi"
VBoxManage: error: Parent medium with UUID {e8b14a7b-9fc7-4467-9fba-24e39346973e} of the medium '/home/angus/VirtualBox VMs/XP/Snapshots/{02c3c883-b19e-4fab-900d-e0be9b7744e5}.vdi' is not found in the media registry ('/home/angus/.VirtualBox/VirtualBox.xml')
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MediumWrap, interface IMedium, callee nsISupports
VBoxManage: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 179 of file VBoxManageDisk.cpp

Code: Select all

$ VBoxManage showmediuminfo "Snapshots/{7e39c27c-8983-41b0-849e-8ff536d9d428}.vdi" 
VBoxManage: error: Parent medium with UUID {9852f952-2bd4-43f7-b633-2d0499abf897} of the medium '/home/angus/VirtualBox VMs/XP/Snapshots/{7e39c27c-8983-41b0-849e-8ff536d9d428}.vdi' is not found in the media registry ('/home/angus/.VirtualBox/VirtualBox.xml')
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MediumWrap, interface IMedium, callee nsISupports
VBoxManage: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 179 of file VBoxManageDisk.cpp

Code: Select all

$ VBoxManage showmediuminfo "Snapshots/{d2b4530e-7ef3-40b4-9a6f-665c29568119}.vdi"
VBoxManage: error: Parent medium with UUID {9852f952-2bd4-43f7-b633-2d0499abf897} of the medium '/home/angus/VirtualBox VMs/XP/Snapshots/{d2b4530e-7ef3-40b4-9a6f-665c29568119}.vdi' is not found in the media registry ('/home/angus/.VirtualBox/VirtualBox.xml')
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MediumWrap, interface IMedium, callee nsISupports
VBoxManage: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 179 of file VBoxManageDisk.cpp
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Recovering from failed snapshot delete

Post by socratis »

AngusM wrote:I had 3 snapshots and I was trying to delete the 2nd one when it all collapsed on me.
Yeah, you're done. I don't think that you can recover anything from what you have, it's a bunch of garbage. As I said from the beginning:
socratis wrote:Restoring from a backup would be the safest choice at this point.
AngusM wrote:I'd at least like to be able to access the files.
You can pretty much forget about it. A differential image contains changed sectors of the (virtual) hard disk, not changes in the files. If you can't recreate your (virtual) hard drive, you're out of luck. See a draft of the Snapshot basics to understand how the whole thing works.

What I *think* might have happened... Here are the series of snapshots:
{de7c2487-8061-4637-a96e-378228b1d5a2}.vdi              XP_old_c_drive.vdi
    {02c3c883-b19e-4fab-900d-e0be9b7744e5}.vdi          GONE!
        {d2b4530e-7ef3-40b4-9a6f-665c29568119}.vdi      Orphaned vdi

{88281da0-61fb-4152-a291-d07edae13aba}.vdi              XP_main.vdi
    {02c3c883-b19e-4fab-900d-e0be9b7744e5}.vdi          GONE!
        {d2b4530e-7ef3-40b4-9a6f-665c29568119}.vdi      Orphaned vdi
With the two intermediate snapshots gone, the latest snapshots are useless. Your data can go as back as 2015-08-03.

Oh, BTW, there's an "XP.vdi" file, which I don't know what it's supposed to do there, it's not referenced from anything. My gut feeling, and based on the dates, that was another VDI that got a snapshot on 2011-12-03, with that snapshot being "{7e39c27c-8983-41b0-849e-8ff536d9d428}.vdi". You could send me the "showmediuminfo" output for both of these VDIs, but given their modification dates I doubt that you'll have anything of use in there since 2011-12-03.

Finally, I don't really like the story so far. If there was something going wrong with the snapshot delete/merge functionality, you would NOT have lost BOTH files. Something's fishy here...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Recovering from failed snapshot delete

Post by mpack »

Something you can try - with absolutely no intended implication that I think it's going to work, is :-
  1. Copy all VDI files (base plus all snapshots) into a new folder.
  2. Identify the newest remaining snapshot VDI and try to clone it with CloneVDI (copy the files to a Windows host, or use Wine to run it on a Linux host). If it lets you then the clone will be good.
  3. If it won't let you clone that snapshot then try cloning the next oldest snapshot - and so on. Obviously this now involves loss of recent data.
Post Reply