Wednesday, January 28, 2009

VirtualBox: discard snapshot

I have always been confused by naming of commands available for snapshots in VirtualBox. Especially, what is the difference between discard snapshot and discard current snapshot and state. For that reason, I made small experiment. I made new virtual machine (without any snapshots) and I performed the following operations:
  1. Make folder named made_before_a
  2. Take snapshot named a
  3. Make folder made_before_b
  4. Take snapshot named b
  5. Make folder made_before_c
  6. Take snapshot named c
  7. Remove all dirs and save state of machine
As a result, the my snapshots were as follows:At this point, I had three possibilities:I wanted to see what would happen if I had performed 'discard current snapshot and state' or 'revert to current snapshot'. Remember that in point 7 above, I removed all my folders, therefore Current State (changed) refers to the guest OS without the folders (i.e. without made_before_a, made_before_b and made_before_c).

Discard current snapshot and state

This option removed snapshot c and the Current State (changed). After starting my guest OA I had only folders made_before_a and made_before_b!

Revert to current snapshot

After this my guest os was in a state at which snapshot c had been taken (i.e. folders made_before_a, made_before_b and made_before_c were restored)

Discard snapshot

Final option is discard snapshot.This option removes the snapshots but not the current state. In other words, I could remove all my snapshots (named a,b, and c) and I was left only with my current state (i.e. no folders)!

Conclusions

  • Revert to current snapshot - it moves guest os to the state it was when the snapshot was made. All changes made since the snapshot creation time will be lost.
  • Discard current snapshot and state - it moves guest os to the state of the previous snapshot. Current snapshot and all changes are lost. In my example, performing operation 'discard current snapshot and state' on snapshot c, moved my systems to state of snapshot b.
  • Discard snapshot- it removes a snapshot, but not the changes made since the creation of the snapshot.

Hope it will be useful and hope I did not make any mistake (apart from my English :-)).

Alternative source of info

This topic was previously discussed. Also, VirtualBox documentation might be handy.