Page 1 of 1

Are snapshots supposed to work like this?

Posted: 12. Aug 2009, 16:08
by Nazgulled
I was using the Snapshots feature to upgrade my Linux guest in case of something went bad I could discard the changes and go back to the previous state and something did went bad and when I decided to discard and go back to the previous state, it discarded more than it should.

Let's Say I don't have any snapshots and do the following steps:
  • Create a snapshot named SNAP1.
  • Boot into the guest and place a file on the desktop named FILE1.
  • Create a snapshot named SNAP2.
  • Boot into the guest and place a file on the desktop named FILE2.
  • Create a snapshot named SNAP3.
  • Boot into the guest and place a file on the desktop named FILE3.
I'll have a snapshot tree like this:

Code: Select all

|--- SNAP1
  |--- SNAP2
    |--- SNAP3
	   |--- Current state (changed)
Now I decide that I don't want FILE3 there and select Current state (changed) and press the button Discard Current Snapshot and State, my snapshot tree will now look like this:

Code: Select all

|--- SNAP1
  |--- SNAP2
	 |--- Current state
And then I boot again into the guest... Now, what I would expect to happen was for FILE1 and FILE2 to be on the desktop, just like I created cause I just wanted to discard the changes done to SNAP3, I only wanted to get rid of FILE3. What happens instead, is that only FILE1 will be on the desktop, FILE2 was discarded too.

How is this possible? I discarded SNAP3, I only wanted to discard the changes done to that snapshot. SNAP2 was changed when I created FILE2 and should be saved with that state, instead, those changes were saved on SNAP3. I don't think this makes much sense...

I mean, to do what I wanted, I needed to do something like this:

Code: Select all

|--- SNAP1 (Before FILE1)
  |--- SNAP2 (After FILE1)
	|--- SNAP3 (Before FILE2)
	  |--- SNAP4 (After FILE2)
	    |--- SNAP5 (Before FILE3)
		  |--- SNAP6 (After FILE3)
		    |--- Current state (changed)
Now, If I wanted to discard only FILE3, I would select Current state (changed) and press the button Discard Current Snapshot and State, this way, I would be in SNAP5, before creating FILE3 (what I wanted) and after creating FILE2 (also what I wanted).

Still, creating 2 snapshots, one before and one after just so I can discard new changes and keep the previous ones, I don't know, it just doesn't make much sense...

Do you agree or think I'm seeing this wrong?

Re: Are snapshots supposed to work like this?

Posted: 12. Aug 2009, 16:52
by mpack
Well, there are really two questions there: (a) is there a mistake in your thinking?, (b) is this how it should work?

(a) The only mistake I suspect you are making is in thinking of the "placing files on desktop" steps as being part of the snapshot that precedes it, when in fact it is part of the snapshot that follows it (i.e. FILE2 was created as part of the current state that became SNAP3, FILE2 did not exist at the time SNAP2 was created). So, if you "delete current snapshot and state" after creating FILE3 then that does indeed mean (to me) a return to the point of SNAP2, when FILE2 did not exist.

(b) Is this how it should work? Of course not! :-)

I personally think VBox should adopt the language of restore points as used in Windows, since at least many people are familiar with that terminology. The GUI should have two options for a VM: "Create a restore point" and "Revert to restore point". The latter would bring up a list of available restore points. The "merge" idea would disappear from the GUI, but could perhaps be retained in the command line form for advanced users.

Re: Are snapshots supposed to work like this?

Posted: 12. Aug 2009, 17:18
by Nazgulled
mpack wrote:(a) The only mistake I suspect you are making is in thinking of the "placing files on desktop" steps as being part of the snapshot that precedes it, when in fact it is part of the snapshot that follows it (i.e. FILE2 was created as part of the current state that became SNAP3, FILE2 did not exist at the time SNAP2 was created). So, if you "delete current snapshot and state" after creating FILE3 then that does indeed mean (to me) a return to the point of SNAP2, when FILE2 did not exist.
I understand what you are saying, makes sense.

Still, like you said in (b), maybe this is not the best way how it should work...

Re: Are snapshots supposed to work like this?

Posted: 12. Aug 2009, 19:58
by Perryg
The way I see using snapshots are to hold a "copy" of the system in case you have a problem with the VM due to an update, Virus, Etc.
If you create a second hard drive as stated below to save your data in then no problem. Other than that (IMHO) multiple snapshots are a waste of disk space and if you click the wrong choice you hose the VM. But this is just my opinion. It works for what it is intended to do and no more. Now if you really want to save 3 or 4 states of a VM then you should consider cloning.

<snip> from UG
Note: The snapshot reverted to will affect the virtual hard drives that are
connected to your VM, as the entire state of the virtual hard drive will be
reverted as well. This means also that all files that have been created since
the snapshot and all other file changes will be lost. In order to prevent such
data loss while still making use of the snapshot feature, it is possible to add a
second hard drive in “write-through” mode using the VBoxManage interface
and use it to store your data. As write-through hard drives are not included
in snapshots, they remain unaltered when a machine is reverted. See chapter
5.3, Configuring image write operations, page 78 for details.

Re: Are snapshots supposed to work like this?

Posted: 12. Aug 2009, 21:22
by Nazgulled
Perryg wrote:The way I see using snapshots are to hold a "copy" of the system in case you have a problem with the VM due to an update, Virus, Etc.
If you create a second hard drive as stated below to save your data in then no problem. Other than that (IMHO) multiple snapshots are a waste of disk space and if you click the wrong choice you hose the VM. But this is just my opinion. It works for what it is intended to do and no more. Now if you really want to save 3 or 4 states of a VM then you should consider cloning.
Not really, I'm using them exactly what they are for... Just because I gave a generic example doesn't mean I'm not using them as they should be used.

I never said I wanted to save the states of a VM... Those 3, 4 or more states where there because each one of them saved an important step in what I was doing (updating the system if you must know) and in case one of the steps went bad, I wanted to be able to discard those changes and start over. In the end, after the upgrade was complete and without errors, the idea was to merge them all back into one state.

And because the way snapshots work, one of the steps that I wanted to discard because it went bad, happened to discard more than I wanted...

Re: Are snapshots supposed to work like this?

Posted: 12. Aug 2009, 22:20
by Perryg
No insult intended. I was just pointing out my view and opinion of how and where to use snapshots.
I have read a lot of posts where some have been trying to use multiple snapshots for backups and for a way to
use a snapshot to open in a different state and then return to the state that they were in before they reverted.
Only reason for pointing this out is so others can read it and hopefully this will help them so they do not kill their VM.

Re: Are snapshots supposed to work like this?

Posted: 12. Aug 2009, 22:41
by Nazgulled
But that's very different from what I was trying to describe. I'm using snapshots as they are supposed to be used, it's just that the current VirtualBox implementation of such a feature is very complicated and not very user-friendly.

Re: Are snapshots supposed to work like this?

Posted: 12. Aug 2009, 23:18
by Perryg
You are not alone. Drop this in Goolge.com snapshots site:forums.virtualbox.org There 694 entries.
I know that information and examples are needed and hopefully we will have them soon.

Re: Are snapshots supposed to work like this?

Posted: 12. Aug 2009, 23:45
by Nazgulled
I know I'm not... But I actually didn't post this here to "rant", I just thought that maybe I was doing or understanding something very wrong... But it seems that's not the case.