Page 1 of 1

Snapshot of deleted disk

Posted: 2. Feb 2016, 18:38
by coatmaker618
I am migrating my VMs from one folder to another folder, and in the process I managed to delete a folder that still had a few VM disks in there. As it happens the rest of the VM wasn't in that folder (vbox & snapshot), just the disk (vdi).

So now I've got a VM with a snapshot of a non-existant HDD. How can I go about restoring that snapshot?



TL;DR stuff:

Backups?
I do have backups, but this is within the same backup. So I would be undoing all the previous effort I did, so it's worth hacking around a bit.

Can't you just restore the snapshot?
It doesn't seem to be that easy! First I had to create an empty hard drive with a matching UUID (in the old location) before it would even attempt to load the snapshot. Now it's complaining about "ahci-0-0" (rc=VERR_INVALID_PARAMETER) telling me to make sure I have enough free space.

Error ID: BLKCACHE_IOERR
Severity: Non-Fatal Error

Anything else?
Most of these VMs are STILL ACTIVELY RUNNING. Only one was taken down for a restart and that's how I noticed! I intend to keep the others running until I can successfully restore one, and go from there.

Re: Snapshot of deleted disk

Posted: 2. Feb 2016, 19:01
by mpack
coatmaker618 wrote: So now I've got a VM with a snapshot of a non-existant HDD. How can I go about restoring that snapshot?
So you have the patch file, and nothing to patch. In which case the VM is dead, unless you have a backup.

If you have any backup at all, no matter how old, then you can take the base VDI from it as a replacement for the file you deleted - as long as the base VDI is from a VM in which the first snapshot was already taken, which is when the base VDI was frozen and given the role of base.

Kludging together a base by hacking UUIDs will only work if the snapshot patches every sector of the base, in which case you can clone the current state and the base drive would never be referenced.

p.s. I deleted your double post of this topic.

Re: Snapshot of deleted disk

Posted: 2. Feb 2016, 19:10
by coatmaker618
mpack wrote:
coatmaker618 wrote: So now I've got a VM with a snapshot of a non-existant HDD. How can I go about restoring that snapshot?
So you have the patch file, and nothing to patch. In which case the VM is dead, unless you have a backup.

p.s. I deleted your double post of this topic.


Oops, didn't realize I posted twice. Thanks for cleaning up that mess.

So the backup is just a patch? that seems like an odd design....this implies that if the VM disk differs in any way from what the snapshot expects, then it can't restore.

This seems strange as it seems to JUST load the OS & programs before throwing that error.

Good to know the limitation of snapshots, I suppose.

Re: Snapshot of deleted disk

Posted: 2. Feb 2016, 19:12
by mpack
Not strange at all. It is what it is. Snapshots are a way of handling multiple states of a VM in a minimal space. They are restore points, not backups. And if you ever confuse the two, consider how restore points in your Windows OS would help if the hard disk died.

Re: Snapshot of deleted disk

Posted: 2. Feb 2016, 19:42
by scottgus1
I would wager a cobbling session on such a guest if certain conditions were met.

Say you have a guest with a base disk and a snapshot. You back up the guest's folder and all its files to another storage medium, in the style of this tutorial Moving a VM, re-interpreted it as "Backing Up a VM".

Then you use the guest a bit more. Your guest still has the base disk and the snapshot. But the snapshot is slightly more modern. Now you delete the base disk by accident. Theoretically the base disk in the backup and the base disk that was deleted will be identical, since the guest's base disk was locked when the snapshot was taken, so no further writes happen to the base disk. You should be able to simply copy the base disk out of the backup back to the original location it was in before it was deleted, and your guest should start up fine.

Re: Snapshot of deleted disk

Posted: 2. Feb 2016, 19:49
by mpack
Uh... I said that already, first reply, in my paragraph beginning "If you have any backup at all, no matter how old...".

Re: Snapshot of deleted disk

Posted: 2. Feb 2016, 20:04
by scottgus1
Wooops, didn't read carefully, my bad...

Re: Snapshot of deleted disk

Posted: 3. Feb 2016, 03:51
by coatmaker618
Ok, so snapshots rely on something in the disk.

Does that mean there is no hope of recovery if the VM is still running? Obviously I can't just snapshot the VM but maybe there's something else I can do? Maybe save a cache or something to that effect?

edit: Guess not! They just crashed, so I'm guessing they were only running because I hadn't asked them to do anything that required disk access yet.

Time to piece together what I have, I suppose.

Re: Snapshot of deleted disk

Posted: 3. Feb 2016, 10:53
by mpack
I answered your last question in the third paragraph of my first reply. This is not to say that the suggestion will work, it is to say that it has a slim chance of working, while nothing else will.

Snapshots are a house of cards, one dependency built on the other. If you pull out a lower card then collapse is almost guaranteed. This lack of redundancy is what really makes it - not a backup. A real backup is entirely about adding redundancy.