How to Use Branched Snapshots in VirtualBox

Craig Buckler
Craig Buckler
Share
VirtualBox
VirtualBox has supported virtual machine (VM) snapshots for a while. However, until version 3.1, it was only possible to revert back to a previous state which destroyed snapshots lower in the hierarchy. VirtualBox 3.1 introduces a great new feature that could help web developers manage multiple virtual machines (VMs). Branched snapshots allow you to create any number of VMs from a single root image. For example, you could install a clean copy of Windows XP SP3 and, from that single image, create snapshots with multiple browser configurations. There are a number of ways to create snapshots, but it’s easiest from the main Snapshots tab. In the following example, we’ll create three snapshots for the root, IE6 and IE7.

1. Create your VM and first snapshot

First, you’ll need to create a new VM, install an OS and all the latest patches. If you’re installing XP, I’d recommend creating a minimal installation using nLite. Once complete, shut down the VM, return to the main VirtualBox window, and click the Snapshots tab: VirtualBox Snapshots tab
Highlight the Current State, then click the Take Snapshot icon (circled in red) and give it a name and description, e.g. “XP SP3”. VirtualBox Snapshot 1

2. Create an IE6 snapshot

The current state should already have IE6 installed, but it’s a good idea to take another snapshot since updates will be applied over time. With the Current State highlighted, click the Take Snapshot icon and give it a name and description, e.g. “XP IE6”. VirtualBox Snapshot 2

3. Revert to the root snapshot

Here’s the clever bit. Highlight the root “XP SP3” VM and click the Restore Snapshot icon (circled in red). You’ll be warned that you’ll lose the current machine state, but click Restore anyway — you won’t lose the IE6 snapshot. VirtualBox Snapshot 3

4. Install IE7

Now boot the VM in it’s current state, then install IE7 and any other software you need. Once complete, shut down the VM.

5. Create an IE7 snapshot

From the Snapshot tab, highlight the Current State, click the Take Snapshot icon and give it a name and description, e.g. “XP IE7”. VirtualBox Snapshot 4 That’s all there is to it. You can create as many snapshots as you need from the root VM and the disk image will only expand as differences are made. To revert to a different state, highlight the snapshot and click the “Restore Snapshot” icon before booting. The main disadvantage with branched snapshots is they are not clones — you can only have one running at a time. It’s not possible to boot both the IE6 and IE7 image. But it’s still a great addition to VirtualBox and will help you test browsers and other software.

Frequently Asked Questions (FAQs) about VirtualBox Branched Snapshots

How do I create a branched snapshot in VirtualBox?

Creating a branched snapshot in VirtualBox is a straightforward process. First, ensure that your virtual machine is running. Then, navigate to the ‘Machine’ menu and select ‘Take Snapshot’. You will be prompted to name your snapshot and provide a description if you wish. Once you’ve done this, click ‘OK’. Your snapshot will then be created. This snapshot will serve as a ‘branch’ point, allowing you to revert back to this exact state of your virtual machine at any time.

Can I create multiple branched snapshots?

Yes, you can create multiple branched snapshots in VirtualBox. This is particularly useful if you want to test different configurations or software without affecting your main virtual machine. To create multiple branched snapshots, simply repeat the snapshot creation process for each new snapshot you wish to create.

How do I restore a branched snapshot?

Restoring a branched snapshot in VirtualBox is just as easy as creating one. First, ensure that your virtual machine is shut down. Then, navigate to the ‘Snapshots’ tab in the VirtualBox main window. Here, you will see a list of all your snapshots. Simply select the snapshot you wish to restore and click ‘Restore Snapshot’. Your virtual machine will then be restored to the state it was in when that snapshot was taken.

What happens to my current state when I restore a snapshot?

When you restore a snapshot in VirtualBox, your current state is not lost. Instead, it is saved as a new snapshot. This means that you can always revert back to your current state if you need to.

Can I delete a branched snapshot?

Yes, you can delete a branched snapshot in VirtualBox. To do this, simply select the snapshot you wish to delete and click ‘Delete’. Please note that deleting a snapshot will permanently remove it from your list of snapshots, and you will not be able to restore your virtual machine to that state again.

What is the difference between a regular snapshot and a branched snapshot?

A regular snapshot is a saved state of your virtual machine at a particular point in time. A branched snapshot, on the other hand, is a snapshot that has been created from another snapshot. This allows you to create multiple, independent states of your virtual machine that you can switch between as needed.

Can I use branched snapshots to test software?

Absolutely! Branched snapshots are perfect for testing software. By creating a snapshot before installing new software, you can easily revert back to your pre-installation state if something goes wrong. This makes branched snapshots a powerful tool for software testing and development.

How much disk space do branched snapshots take up?

The amount of disk space that a branched snapshot takes up depends on the changes made to the virtual machine since the snapshot was taken. Generally, each snapshot will take up a few gigabytes of disk space. However, this can vary depending on the specific changes made to the virtual machine.

Can I export a branched snapshot?

Yes, you can export a branched snapshot in VirtualBox. To do this, simply select the snapshot you wish to export and click ‘Export’. You will then be prompted to choose a location to save the exported snapshot.

Are branched snapshots compatible with other virtualization software?

Branched snapshots created in VirtualBox are specific to VirtualBox and may not be compatible with other virtualization software. However, you can export your snapshots in a generic format that can be imported into other virtualization software.