Learn how to manage and understand snapshots in vSphere 6.5.
- [Instructor] Snapshots are a great tool for a lab environment. They allow us to save the state of a virtual machine, then make changes and experiment with it, and return back to the original state. Before we continue I have to emphasize using caution when taking snapshots in a production environment. They are not intended to be used as backups, and running on snapshots for long periods of time, more than a day or two, or running off too many snapshots can significantly degrade the performance of your virtual machine. In addition, you shouldn't take snapshots on a virtual machine that syncs with an outside source, such as an active directory server.
Vmware has an excellent Knowledge Base article discussing snapshots. It's article number 10105180, and it has a lot of detail about how snapshots work, and the precautions you should take with using them. Let's take a look at using a snapshot. Lenox VM1 here currently has no snapshots on the virtual machine. If I go to the directory where that virtual machine is being stored, and I do a ls dash l, we can see that right now there's the single vmd k file, there is the disk for that virtual machine.
And I right click on it, take snapshot, we'll call this one snapshot one. Notice I have the option of snapshotting the virtual machine memory. If I snapshot the memory, then I have the option of coming back to a live running virtual machine. Without the contents of memory, the virtual machine I come back to is going to be shut down. For this one, I'm not going to take a snapshot of memory, I'll click on okay. Watch the process, and without memory it goes really really quick. The reason it goes quick is that we're not making a copy of the hard drive, and then running off of that copy.
Instead, let's take a look at the drive now. What happens is that the original disk is still there, and it has become read only, and we've created a new disk that's called a delta disk. Now all writes to this virtual machine are going to go to that delta disk. Reads are going to either come from the delta disk first if it's a block that's been changed, or from the original disk if it's a block that's not been changed since we took the snapshot. Now I have this little target indicating this is where I'm currently running off of snapshot one.
Which means I'm running off of my first delta disk. Let's take a second snapshot, and this time I'm going to snapshot the virtual machine's memory. Now this one takes significantly longer. As the entire contents of memory of the virtual machine is being written to disk. Once it's completed, I now have my second snapshot, and notice it has a little green triangle indicating that it has memory, and thus can be a running virtual machine.
Now let's go take a look at the disk. Notice now I have three vmd k files. My original disk, and the first snapshot are both read only now, and all writes are going to the second delta that's been created. Now any changes I make to the virtual machine are going to be reverted to if I go back to an earlier version of the snapshot. And that includes changes to the virtual machine hardware. So if I were to come in here, edit the settings on this virtual machine, and add in a new network adapter.
So now if we go to monitor, or summary, we'll see that we have two network adapters on this virtual machine. Go back to snapshots, when I select this snapshot and I say revert to, what I'm saying is I want to delete all of the information that has changed since I took that last snapshot, and it's going to give me a warning, and now I've just jumped back in time to the point where I took that snapshot.
Go back to summary, and we'll see that I only have the single network adapter. If we take a look at the disk, now we're going to see that I'm running off of a zero three delta disk. As two got deleted, and now I'm running off of a new one. When I select delete all, what's going to happen in this case depends on where this little blue target is. In this example here, if I delete all of the snapshots, then the data from both of those delta disks is going to get rolled back up into the original because it's running off of both of those.
So we do actions, delete all snapshots, and this has no effect on our running virtual machine, we're just consolidating all of the disks back into a single disk, and we no longer have the ability to move back and forth between the snapshots. And now there's no snapshots on this virtual machine. If we take a look at Linux VM2, the situation here is a little bit different. I have four snapshots, first I took a snapshot and that was snapshot one, then I took a second snapshot on that same chain, that became two.
And then the third one became snapshot three. At that point, I reverted back to the original disk, and took another snapshot, and that became four. So the chain that I am running off of where this target is, is one and four. The data that is on two and three is not part of my current chain. So when I go to all actions, and delete all snapshots, all of the data that is in two and three is going to be lost forever. One final example here, I'm running off of the second snapshot currently, and I can select the first one and do a revert two.
Now notice now the virtual machine is going to come back powered off. So now I am here, I'm running in between the first and the second snapshot. If I now delete this second snapshot, all of that information is once again going to go away, because it's not part of my current running chain. Snapshots are rather complicated, so don't get too complex with them, however they do make a great tool for being able to jump back in time. I highly recommend playing around with them and observing what happens on the disk when you do so.
- Virtual machine benefits
- Building a lab environment with a mini PC
- Working with ESXi and vCenter Server
- Installing a control center VM
- Using the HTML5 client and the web client
- Adding an ESXi host and use Remote Console
- Configuring vSAN and storage profiles
- Adding NFS datastore
- Deploying a virtual machine from OVA
- Performing a cloning operation
- Using templates
- Performing a vMotion migration
- Working with snapshots