Sometimes you may want to take a snapshot of the current state of your virtual machine (in my case Ubuntu Linux) so that you can revert back to it if anything goes wrong in the virtual machine. The feature in VirtualBox which helps in this is called a snapshot.
A snapshot is basically a backup of your virtual machine in its current state.
Taking a Snapshot
To take a snapshot do the below
- Run the virtual machine from the Virtual machine Manager.
- Go to the Machine Menu option in the running instance of the Virtual Machine and click on Take Snapshot
- This will pop up a window asking for the name and the description of the snapshot.
- Give a suitable name and write some description so that you can identify in what state the virtual machine is at a later stage.
Now at a later stage when you want to go back to a snapshot because your current machine has got some problem or maybe you have made loads of upgrade in the current machine and something is not working:
- go back to your VirtualBox Manager.
- Click on the particular virtual machine you want to revert back
You can see two Options on the right hand pane 1. Details 2. Snapshots.
If this is how it looks it is easier to think what your next move is, i.e. to click on the Snapshots option and take it from there.
However, it maybe sometimes bit confusing particularly if the Details option was selected at a earlier time, the content on the right hand pane may look different. Lets see how that looks, click on the Details option and the right hand pane will look like this:
In my Vitual Box this was the case and I was wondering how to go back to the Snapshot mode. Just click on close (x) icon on the Details button and you will see the right hand pane having both the options again. This sounds bit stupid but sometimes stupid things happen.
Ok going back to the original discussion about snapshot. Click on the Snapshots options as marked below:
Once you click on the Snapshots option you will something like the below:
As you can see in the above picture there a snapshot which I had taken called Ubuntu 12.04 – Xtensa Tooclchain installed. This is presently under the Snapshot 1. The reason being I had to revert back to my original Snapshot before I wrote this blog. I had corrupted my original VM machine and once you revert back you loose the current state of the machine.
I will now take example of another running VM whose current state looks like the below:
Tere is already a snapshot taken on this VM. Now I will take another snapshot on this VM following the steps as described previously and it looks like this:
As you can see a new snapshot has been created under Snapshot -1 and it is called “Example Snapshot – for demonstration“.
Lets Take couple of more Snapshots and it now looks like the below:
Deleting a snapshot
To delete a snapshot follow the below steps:
Select the particular snapshot to be deleted, for example snapshot “Example Snapshot – 2” and click on the Delete Button above:
It will ask for a final confirmation, confirm delete (if you really want to delete – Don’t otherwise)
Once you confirm the deleted snapshot goes away from the list, the list now looks like:
Restoring a Snapshot
If you want to restore back to a particular snapshot in the snapshot list select the particular snapshot you want to revert to, for example we want to now get back to the snapshot “Example Snapshot – for demonstration”, so select it in the list and then click on the Restore button at the top:
Once you click on the Restore button it will ask for confirmation. In the confirmation there is a check box asking if you want to take a snapshot of the current state of the virtual machine, If you want to do that check this box, like in this example we have checked this box and now once the Restore confirmation button has been selected it is asking for the snapshot name (name for the snapshot of the current vm state before restoring to the original snapshot). Provide a name.
I gave a name like “Final VM State before Restoring”.
Now it looks like below:
As you can see the “Example Snapshot – for demonstration” is in bold faced as it has been restored back.