Snapshots and virtual machine cloning
In this chapter, we will continue to discuss how to use virtual machines, walk you through cloning and snapshot creation. This functionality is crucial when it comes to working with virtual machines.
Imagine you have downloaded an application and are installing it on your virtual machine. The application behaves suspiciously, and you remove it just to be on the safe side. What should you do with the virtual machine? Perhaps it has already been compromised, and using it is no longer safe.
It would be wise to destroy it, but in this case you will have to create a new virtual machine, perhaps all the software you need for work already runs on this virtual machine. Creating a new machine and adjusting the system is definitely time-consuming.
To eliminate the need for creating a new virtual machine, you have two options. You can create a parent system and just clone it. You set up a virtual machine, install the system and all the software you need. After that choose the virtual machine you created and press “Clone”.
Give you clone a name. At the next step, select “Create a full clone”, wait until the cloning process is completed, and now your system is ready to run.
If you need to test something, you run your clone, and after using it, you delete it and spin up a new clone without affecting the parent virtual system. Enjoy the best of both worlds.
Set up the parent virtual machine and then clone it to resolve your issue.
Cloning is not the only way to save the virtual machine with all the adjustments you have made. If you need to save the current state of your virtual machine, you can create snapshots. Snapshot is a copy of a particular state of a virtual machine you are always able to roll back to.
The best analogy here would be a computer game. Before taking on a particularly difficult boss or stage, you save your game progress, and if you fail, you download from there. When you use your virtual machine, you can make several snapshots, and at any moment roll back to any of them.
To create a snapshot, on the VirtualBox menu bar, select “Machine Tools” and then “Create”. In the window that will appear, select a name and a description of your snapshot.
When you need to restore some version of the machine, you select the snapshot and then press “Restore”.
Finally, let me say a few words about live systems. A live system cannot be installed on the hard drive of your computer, it saves all data in RAM receiving it from the image of the operating system. A live system has obvious advantages: the launch of the system is faster, there is no need in installing it hard disk.
The disadvantages of a live system: it is amnesiac – the system forgets everything when you turn off your machine. If you want to save data to the hard drive, you need to perform a full installation.
In the previous chapter, we showed you how to create a virtual machine running on operating system Linux Mint. Perhaps you have already run the system. Originally it is launched as a live system, and you probably feel you need to have the option of data saving. Let’s skip forward: when you launch your machine, select “Install Linux Mint” and follow the installation guide.
Make sure you create a parent system to spin clones from it. From there we will be working with the clones of your parent machine.