How to use SNAPSHOTS in VB. A Simple-to-understand Guide.

This is for discussing general topics about how to use VirtualBox.
Post Reply
polocanada
Posts: 19
Joined: 12. Sep 2009, 18:16
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Windows Server 2003

How to use SNAPSHOTS in VB. A Simple-to-understand Guide.

Post by polocanada »

Reading the user guide for VB I find it is not very clear in several areas from command line functions to taking snapshots. Today, I looked into snapshots and decided to write this simple, easy to understand guide:

Prerequisites:

Virtual Machine
Initial Snapshot (optional, e.g week ago)
Snapshot DAY 1 (e.g. 2 days ago)
Snapshot DAY 2 (e.g. 1 day ago)
Current state (changed today)

Snapshot commands explained:

1) REVERT TO CURRENT SNAPSHOT (Ctrl+Shift+R)

This will discard changes in the "Current State" and go back to how the machine was in the LAST = MOST RECENT snapshot we've done, that is DAY 2.

When to use this: e.g. You installed a crappy software and machine doesn't boot. So you want to go back. Result would be like if you would go to "Last Known Good Configuration" under Windows.

2) DISCARD CURRENT SNAPSHOT AND STATE (Ctrl+Shift+B)

This will discard changes in the "Current State" AND in "LAST = MOST RECENT snapshot" we've done, that is DAY 2 and it will go back to how it was on DAY 1.

When to use this: A) You installed crappy software before you took Snapshot DAY 2. So you need to go to DAY 1. B) You decided to go back to ORIGINAL state of Virtual Machine (or to Initial Snapshot) and you don't need/want snapshots. Initial Snapshot is an option, you don't need it if you plan to revert to original state of virtual machine.

3) DISCARD SNAPSHOT (Ctrl + Shift + D)

This will be done without warning dialog! It will just delete the snapshot which is marked but keep the CURRENT STATE. The current state will have all changes up-to-date. If you want to delete all snapshots, you will have to do it to each of them. You can delete the snapshots in any order you like without effect on the current state.

When to use this: e.g. When you are satisfied with the current system state or your work and you don't need to keep the old(er) snapshots because you don't want to go back. It's like if you delete old Windows System Restore profiles to make more space in Windows.

----
Important note:

If you have done snapshots and you want to go back to original virtual machine you must to it the way in point #2 above. (At least I haven't found any other way.) If you try to delete snapshot manually (in Windows Explorer), you won't be able to load the machine. If you try to delete the machine from Virtualbox GUI, it will tell you it can't unregister because it has snapshots attached to it.

It is not possible to move snapshots between identical installations of same virtual machine because they have unique identifier in the file name.

Some ideas ...

However, it could be possible to copy snapshots between 2 computers with exactly identical virtual machines. If we create ONE snapshot AND take a copy of your virtual machine complete with that snapshot and copy it on a second computer (to possibly exact drive and location) and THEN we should be able exchange just the snapshot back and forth between computers and keep the whole virtual machine up-to-date. This remains a theory until somebody can prove. Perhaps, using Livemesh.com we could keep the virtual machines in sync that way. If we don't use Paging file in VM or it is deleted on machine shut-down, then the snapshot should be reasonably sized.

Maybe sounds like a crazy idea, but perhaps it may work for a limited number of cases when required. For instance, we would need to sync the whole machine state, not just the files changed (which of course can be done using USB flash drive, as well as using a shared folder which is then synchronized using Livemesh.com). Expanding on this, perhaps this could be a good idea for Sun Virtualbox to incorporate into next version of VB 4.x

Anyway I'm talking too much. Hope this guide helps.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: How to use SNAPSHOTS in VB. A Simple-to-understand Guide.

Post by Sasquatch »

Great explanation of the feature. The move of machines with snapshots to other machines, or even other places, can be done as long as the whole set stays in tact and the needed files (XML) are modified to reflect the new situation. VB must be shut down before doing any work on the XML files.

As for the new version, 3.1.0 will be next. Version 4.0.0 will be next year on it's earliest, but probably in two years (somewhere in 2011). In 3.1.0, the wordings and description should be changed to make it more clear what each option does. Let's hope it won't be as vague as the last change they made in 1.6 or 2.0 (don't remember exactly). They should abandon the whole revert and discard names, as it's quite confusing.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
MarkCranness
Volunteer
Posts: 875
Joined: 10. Oct 2009, 06:27
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows Server 2008 R2; Ubuntu 11.04; Windows 2000 Server; Windows XP

Re: How to use SNAPSHOTS in VB. A Simple-to-understand Guide.

Post by MarkCranness »

An accurate explanation of how it currently works.

However, how 'DISCARD CURRENT SNAPSHOT AND STATE (Ctrl+Shift+B)' works is a bug or design error.
Going back TWO snapshots is a mostly useless feature.
It was intended to only go back ONE snapshot, then delete that snapshot, still leaving you at the snapshot 2 state, BUT with snapshot 2 deleted.

How it should work is shown in the status bar information text for the 'DISCARD CURRENT SNAPSHOT AND STATE (Ctrl+Shift+B)' button, which reads:
''Discard the current snapshot and revert the machine to the state it had before the snapshot was taken'.

It does work as the status bar text describes when there is only ONE snapshot.
Post Reply