In the first article in this series about GNOME Boxes, I explained how to get started with the virtualization application, and in the second article, I described GNOME Boxes' remote access capabilities. Here in the third installment, I will cover GNOME Boxes' snapshot functionality, which is a useful way to preserve data quickly.
Snapshot technology, which has been implemented in databases, filesystems, and operating systems, is extremely useful with virtual machines (VMs). Taking a snapshot of a VM preserves its state at a specific point in time. Restoring or reverting the snapshot returns the VM to that state, regardless of any changes made after the snapshot was taken. This capability can be useful for conducting tests of new software or patches and also when something has gone horribly wrong. As a virtualization tool, GNOME Boxes has this feature.
Snapshots allow us to move forward and backward in time. We can save the Box at various points and revert to those points whenever we want to revisit one. There is one important thing to remember, though. The current, running state of a Box can be considered the active state. When you revert to any snapshot, you will lose the active state. So, if you intend to (or think you might) return to the current state, you must take a new snapshot prior to reverting to another one. Note that this feature is not applicable to remote Boxes.
To access the snapshot feature, click the Properties menu on a local Box. If you are on the main screen, right-click on the Box. If you are viewing a Box, you can access the menu from the button in the top-right corner. Then click Snapshots at the top of the Properties screen.
Creating a snapshot
The Snapshots screen shows all existing snapshots and a small plus (+) button at the bottom for creating new ones. Go ahead and click the plus button. The first thing you see is "Creating new snapshot…" and a progress indicator. Be patient, as creating a snapshot can take a few minutes. When it's complete, the new snapshot appears with the date and time it was created and a small gear icon. This icon brings up the Actions menu for reverting, renaming, or deleting the snapshot.
That's it! You now have a snapshot of your Box.
Reverting a snapshot
Suppose you are a tester. Each time a new version of your product is built, you need to conduct user acceptance testing. You could create a new VM every time or replace the old version with the new one. That can be a time-consuming process. Removing an old version may not completely remove all remnant files, which could taint future testing. This is where a snapshot comes in incredibly handy. Simply revert to a previous, "known-clean" state before each new test to ensure the integrity of the test.
Or suppose you made some changes to your VM and ran a few scripts, then you realize some important files in your home directory were mistakenly deleted. You don't need to worry, though. You can go back to the Snapshots screen, select the Actions menu for the snapshot named 08/15/2019, 10:28:52 AM, and click Revert to this state. The Box will be returned to the exact point when this snapshot was taken.
Renaming a snapshot
As you create more snapshots, it can get confusing to keep track of them based only on the creation date and time, which is Boxes' default naming convention. For this reason, it is good to rename your snapshots to make them more descriptive. Just open the Actions menu for the snapshot and select Rename from the drop-down.
Deleting a snapshot
If you decide you no longer need to keep a snapshot, it's easy to delete it. Just go back to the snapshot's Properties and select Delete from the menu. Deleting a snapshot will not interfere with any other snapshot or the active state of the Box.
As I have shown in my previous Boxes articles, you can have one or more VMs—or as GNOME Boxes calls them, Boxes.