Restore from a .sav file?

This is for discussing general topics about how to use VirtualBox.
Post Reply
alan93
Posts: 23
Joined: 17. Nov 2010, 16:08
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP

Restore from a .sav file?

Post by alan93 »

I made backups of .sav files thinking I would have a back up.
I made the mistake of deleting snapshot files in order to free up hard drive space.
One thing I didn't count on is that on a Mac OS X, when a file is in the trash it is still being used by VB but I thought it wasn't so I deleted it for good. Well it turned out those snapshots were really needed AND being used while they were in the trash.

So i have these .sav files. Can i restore a session from these?
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Restore from a .sav file?

Post by socratis »

.sav files are the contents of the memory when you saved the machine state. They cannot be used to reconstruct the contents of the hard drive, which is what snapshots are used for. I'm afraid you're out of luck if you do not have a backup.

To better understand what snapshots are and how they work, I'll quote a text that does a very good job of describing them:
ChipMcK in a [url=https://forums.virtualbox.org/posting.php?mode=quote&f=1&p=276859#pr276859]recent post[/url] wrote:When a virtual disk is first created for a new virtual machine, it is considered as the base disk for the guest - data for the guest is read from and written to that disk image.

The differencing disk records changes sector-by-sector to the whole disk image, not changes to any file in the disk. VirtualBox does not know what file system is employed on the disk image and therefore can not access any individual file of/on the disk image; only the guest OS is aware of that information.

First SnapShot creates a differencing disk for read/write access while the base disk becomes read-only - as the guest modifies its data, the data is written to the differencing disk and the base disk is untouched.

Second SnapShot creates another, new, differencing disk for read/write access while the first differencing disk becomes read-only along with the base disk.

Subsequent SnapShots create additional differencing disks, with the preceding differencing disk joining the hierarchy (pecking order/chain) of read-only disks.

Keep in mind that access to/from the virtual disks is sector-by-sector, not file-by-file.

When the guest requests that a sector be read, the latest SnapShot is read first. If the sector is not found there (Sector-Not-Found is returned), the next SnapShot in the chain (youngest to oldest), until the base virtual disk is reached. Then the sector on/in the base virtual disk is either read or Sector-Not-Found is returned.
If you manually delete a snapshot, you break the chain. VirtualBox has no way of recreating the data, which means that you can only go back to the last available snapshot chain available.
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: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Restore from a .sav file?

Post by mpack »

I must say that I have doubts about the part where VirtualBox uses snapshot elements that are in the trash. I can't see how that would be the case unless OS X leaves some kind of smart link in the original folder, which seems counter productive (you want to know if the deletion will break something, and you want to know it before you empty the trash).

VirtualBox will complain about registered media it can't find.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Restore from a .sav file?

Post by socratis »

mpack wrote:unless OS X leaves some kind of smart link in the original folder
It kind of does, it kind of doesn't. The general idea is that if a file in use is moved to the Trash, the handle to the file remains valid and the program that is using the file can keep on working happy. Even saving the file works! In VirtualBox this is how it works:

VirtualBox is launched. It checks the existence of base .vdi plus any snapshots. Everything checks out (otherwise you get an "inaccessible" message). After that, you can find yourself in this situation, if, you launch the VM (making use of the last snapshot) and then you go into Finder and delete the snapshot. Snapshot goes to the Trash. It keeps on being modified.

Now, if you try to relaunch the VM, the snapshot won't be there and the launch will fail in an expected, spectacular way.

Oh, BTW, you don't need snapshots to make this work. You can very well move a snapshot-less VDI to the Trash and everyone is going to be happy ;) Of course you cannot empty the Trash while VirtualBox is running, because the file is in use. One of the most classical messages of the Mac since the Classic days.
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: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Restore from a .sav file?

Post by mpack »

So the presumption is that the software is still running? I didn't catch that from the original description.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Restore from a .sav file?

Post by socratis »

Yes, that's the only way that it can be done. Otherwise, and rightfully, VirtualBox will complain. A hint can be found in the original post:
alan93 wrote:when a file is in the trash it is still being used by VB
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.
Post Reply