Create and Restore Snapshots in Virtual Box
If you've already joined systems virtualization, you know very well that things can go really badly. If you haven't joined yet, find out it's true. Mistakes happen, tests go wrong and some systems are not prepared for what we want to do. Unfortunately, the time required to reset a system to a valid state is intolerable. The good news is that in virtualization environments, there is a way to save the state of our systems. This way you can return to them and continue your tests from the same starting point. Check out how to create and restore Snapshots below!
In Virtual Box, we can store the state of a system by creating a so-called snapshot. This consists of an image of the current state of the system. Snapshot stores information about the virtual machine's memory and disk, allowing you to return to this state in the future.
Actually, creating a snapshot in Virtual Box is quite simple - following the machine menu we have the option “Create Snapshot”. Clicking on it opens a window where we can enter the snapshot name and description.
A good time to create this snapshot is always before making any major system changes, such as installing a complex application or changing deep definitions. A good example is the installation of Virtual Box guest additions, a bundle of additional operating system-specific elements that allows for better behavior of the guest operating system. These add-ons can be installed from the “Devices” -> “Install guest add-ons” menu with the running virtual machine.
Using the virtual machine manager (the application we use to launch the virtual machine), we can see the sequence of snapshots created by us on the machine, and eliminate the ones we no longer need. You can also view details about the snapshot, such as the state the virtual machine had at resource level, as well as create state copies (via the sheep icon).
When things go wrong and we need to go back, the solution is to restore a snapshot. To do this, we must go to the machine, and from the list of existing snapshots for the machine, choose the point we want to return to and click the "restore snapshots" button (the up arrow screen icon).
After this step (and choosing whether or not to save the current state as a snapshot), just start the virtual machine. With this we return to active with a machine in the state in which we recorded it.
When working with virtualization, it is important to be mindful of creating and restoring Snapshots. This can avoid wasted time and data on errors and test failures. This is where it is important to perform testing to prove it is safe to use, and to introduce it into our workflow.