In this video Grant shows us how to use VirtualBox snapshots including how to create snapshots with a simple keystroke and how to roll back to any previous snapshot easily.
- View Offline
- [Trainer] Virtualization gives us a lot of power that we don't have with physical machines. One of those things is snapshots. Do you remember from a previous conversation we talked about screenshots and snapshots. To do a screenshot, you do your host key, which in my case is a right ctrl key + e, and that'll bring up a dialogue asking where to save it. This would be a picture of the virtual machine. If we do a right ctrl key + t, it'll do a snapshot. The snapshot saves the state of the virtual machine, that means all the installed packages and the running applications.
Let's go ahead and give this snapshot a name. At any point in time, we can roll back to this previous snapshot. Let's say we need to do some operating system updates and something breaks, we just roll back to the snapshot that we created before the update. So let's give a description in here, we'll call it base install, click on OK. If you now do something else, and you want to roll back to this snapshot, the easiest way to do this is just to click the close gadget for the virtual machine window.
You'll see that you have a couple choices. Save the machine state, send the shutdown signal, and power off the machine. Underneath power off the machine is restore current snapshot test 1. If we leave that checked, and we power the machine off, it'll restore your virtual machine back to the state when you created that snapshot. Let's go ahead and uncheck that box, and click on cancel. To show how this works, let's go up to your applications menu, to accessories, calculator.
Now we're gonna create a snapshot with the calculator running, Control t, will just call this one calculator, and click on OK. Now close the calculator, and we're going to roll back by clicking the close gadget, and we're gonna restore current snapshot calculator, click on OK, it'll shut down the virtual machine. We'll wanna then start the virtual machine back up, and you'll notice it started very, very quickly.
This virtual machine didn't actually boot up the operating system, it just restored the state that it was in. The state was, the calculator was running. If you wanna do anything more complex with snapshots, you're going to have to use the virtual box manager interface. You'll see that we have our CentOS 7 net installed virtual machine running, and we'd have our normal details right here, next to the details is snapshots. We have the Test 1 snapshot that we've created, and we also have the calculator snapshot.
If you wanna delete any of these, click on the calculator, and click on the little camera with the x, and click on delete. That snapshot is now gone. If you'd like to create a new snapshot, click on the camera icon on the left hand side, and we can call this one Test 2. Normally I'd recommend that you put a description in there. In this case, I've just installed and I have not done updates yet. Click on OK. Now we have two snapshots, Test 1 and Test 2. If you'd like to see details, click on the camera icon with the orange circle and you can see the details that I just entered.
Now you notice that there's an icon between the snapshot icon and the one with the x. This is for restoring but is ghosted out because our virtual machine is currently running. Go ahead and shutdown your virtual machine, and we're gonna uncheck restore current snapshot, because, we don't want it rolling back, we just want it to shutdown the way it is. You'll notice that the restore icon is now unghosted. So we can click on whichever snapshot we want, and click on the restore icon. It'll ask you if you want to restore, and there's an option at the bottom called create a snapshot of the current state.
This is gonna take the current state that it was running and make a new snapshot. If you don't wanna save the current state, and you truly wanna roll back to Test 1, you wanna uncheck that box and then click on restore. That means the current state is now lost, but our virtual machine will be reset back to Test 1. Let's go ahead and start our virtual machine back up. This is the state that we had before we started the calculator application, and before we created our other snapshots. That's a quick look on how to use snapshots in virtual box.
- Choosing a Linux distribution
- Installing VirtualBox
- Installing CentOS
- Configuring basic Linux settings
- Exploring GNOME 3