Virtual machines (VMs) revolutionized the data center. With the ability to easily spin up a machine and even roll back to a working state, VMs bring a level of ease IT would never have enjoyed. Rolling back your VM is handled by way of snapshots. If you’ve never used the snapshot feature in your virtual technology, let me first explain why they are so crucial.

Snapshots allow you to save a particular state of a VM; this can be handy when you want to test something, or you’re about to make a change to that VM, and you need to be able to roll back to a working instance. Not only does this save you a lot of headaches, but it can be a serious time-saver.

Every VM technology has its version of snapshotting…VirtualBox included. It’s easy to manage snapshots in VirtualBox–you can take snapshots of a running VM or a VM in a saved or even off state. Once you create a snapshot, you can restore a previous snapshot, delete a snapshot, and view details of a snapshot.

I’ll walk you through the steps of taking a snapshot and rolling back to a snapshot in VirtualBox. You’ll be surprised by how easy this process is to complete.

SEE: Virtualization Policy (Tech Pro Research)

Creating a snapshot

You can create a snapshot when a VM is either on, saved, or off. I’ll demonstrate the process of taking a snapshot when the VM is powered on; I’ll show how to do this with a Red Hat Enterprise Linux (RHEL) 7.3 VM.

Once the machine is up and running click Machine | Take Snapshot. A new window will appear, prompting you for a name and a description of the snapshot (Figure A). It’s important to fill out the name and description because you might take multiple snapshots, and you don’t want to get those snapshots confused; plus, this allows you to restore back to multiple points in the configuration.

Figure A

Once the snapshot is taken, you can go back to work on the VM.

You can also create a snapshot from a VM in a pause or off state. To do this, select the VM in the left pane, click the Snapshots button in the upper right corner, select Current State, and then click the Snapshots button (Figure B).

Figure B

Restoring a snapshot

Say you’re working in your VM, and you make a change that breaks the system…what do you do? You roll back to one of your previous snapshots. To do this, it’s as simple as creating a snapshot, with a couple of caveats.

First and foremost, the VM you want to work with must not be running. You can restore a snapshot if the VM is either in a saved state or powered off. To restore a state, do the following.

  1. Select the VM to work with from the left pane in the main window.
  2. Click the Snapshots button in the upper right corner.
  3. Right-click the snapshot you want to restore.
  4. Click Restore Snapshot (Figure C).
  5. In the resulting window, uncheck the box for Create A Snapshot Of The Current Machine State.
  6. Click Restore.
  7. Allow the restore to complete.

Figure C

The reason why you uncheck the box for Create A Snapshot Of The Current Machine State is because, most likely, you won’t want to take a snapshot of a broken state; instead, you’ll want that broken state to go away. If you do want to save that broken state (or whatever state the VM is in to make you want to restore a previous instance), you can leave that box checked. You will get the chance to name that current state and give it a description. That means it’s not actually overwriting your current saved state.

There is another way to restore snapshots. If you’ve taken snapshots of a VM, when you go to close it you will see an extra entry in the close dialog (Figure D). This entry allows you to restore to the current snapshot (i.e., the one that was taken most recently) as the VM closes. The next time you start the VM you will be at the current snapshot. This option only gives you the ability to restore to the current saved snapshot–you don’t get to choose.

Figure D

Deleting a snapshot and discarding a saved state

It is possible to delete a snapshot or to discard a saved state. To delete a snapshot, do the following.

  1. Open VirtualBox.
  2. Select the VM in the left pane.
  3. Click the Snapshots button in the upper right corner.
  4. Right-click the snapshot you wish to delete.
  5. Click Delete Snapshot.
  6. When prompted, click Delete.

You can also discard the current state by selecting the VM in the left pane and then clicking the Discard button (the downward pointing arrow). When prompted, click Discard, and the saved state will be discarded. Note: When you discard a saved state, it is like powering off the machine without doing a proper shutdown–this can cause problems with your VM, so use it very wisely.

A must-use feature

If you’re not using snapshots on VirtualBox, you’re doing it wrong. Snapshots is a must-use feature that will serve you very well and save you from possible frustrations. Start working with snapshots immediately…you won’t regret it.

Subscribe to the Data Insider Newsletter

Learn the latest news and best practices about data science, big data analytics, artificial intelligence, data security, and more. Delivered Mondays and Thursdays

Subscribe to the Data Insider Newsletter

Learn the latest news and best practices about data science, big data analytics, artificial intelligence, data security, and more. Delivered Mondays and Thursdays