Disaster Recovery for Hyper-V (Part 2)

If you would like to read the next parts of this article series please go to:

Introduction

In my first article in this series, I explained when it is and is not appropriate to use virtual machine snapshots and about how snapshots work. In this article, I want to show you how to actually use snapshots.

Creating a Snapshot

The procedure for creating a snapshot is actually very simple. If you look at Figure A, you can see that I have opened the Hyper-V Manager console, and selected one of my virtual machines that is presently running. If you look at the column on the right side of the console, you can see that it is divided into an upper and a lower section. The upper section contains action items that pertain to the server as a whole. The lower section contains items that are specific to the virtual machine that is currently selected. The third option from the bottom is Snapshot.


Figure A: The column on the right contains an option to create a snapshot of the currently selected virtual machine

When you click the Snapshot button, Hyper-V will begin taking the snapshot. The process does not take very long at all. If you look at Figure B, you can see that by the time I was able to click the screen capture button, the snapshotting process was already 25% complete.


Figure B: It only takes a few seconds to make a snapshot

After you create a snapshot, the snapshot will appear in the Snapshots pane beneath the list of virtual machines. If you look at Figure C, you will see that I have taken two snapshots, both of which are listed in a snapshot tree. The reason why the snapshots are listed in this way is because snapshots are cumulative.


Figure C: Hyper-V displays a list of snapshots in a tree format

Settings

As you can see in the figure above, Hyper-V tells you the date and time when each snapshot was recorded. Although this is helpful, it can be a little bit tough to remember the virtual machine state that is associated with each snapshot.  Fortunately, Hyper-V allows you to make some notes regarding the purpose of each snapshot.

To do so, right click on the snapshot that you want to annotate, and then choose the Settings command from the shortcut menu. This will cause Windows to display a screen that is very similar to the virtual machine’s Settings screen. The biggest difference between this screen and the normal Settings screen is that you can not change any of the hardware settings.

Click on the Name option, and you will have the option of changing the snapshot’s name and entering some notes about the snapshot, as shown in Figure D. When you click OK, your notes will appear in Hyper-V Manager’s lower middle pane, as shown in Figure E.


Figure D: The Settings screen allows you to make notes about your virtual machine


Figure E: Your notes will appear in the console’s lower middle pane when you select the snapshot

As you saw in Figure D, the Settings screen gives you the option of renaming the snapshot. You can also rename a snapshot by simply clicking on the Rename option located in the lower portion of the console’s Actions pane.

Using Your Snapshots

As I explained in my first article in this series, snapshots are not intended as a long term backup solution. They exist so that you can make a backup prior to performing a potentially risky operation. Once you have completed the operation and tested the virtual machine to find out whether or not the operation was successful, you need to do something with the snapshot that you have taken.

If the operation was a success, then you can just delete the snapshot, and the changes stored in the snapshot will be merged with your frozen .VHD file. If the operation does not go as planned, you can roll the machine back to the time when the snapshot was made and then delete the snapshot. Performing either of these tasks will return your virtual machine to using a single .VHD file, although you will have to either reboot the virtual machine or put it into a saved state to complete the operation.

Applying a Snapshot

Suppose that you created a snapshot of a virtual machine prior to performing a risky operation. When the snapshot was complete, you performed the operation, and everything went horribly wrong. In such a situation, you would obviously want to restore the snapshot.

To do so, just right click on the snapshot that you want to restore, and then choose the Apply command from the shortcut menu. Doing so will cause Hyper-V to display the warning message that is shown in Figure F.


Figure F

As you can see from the warning message above, applying the snapshot causes the virtual machine’s current state to be lost, which is what you want if the virtual machine has been trashed. You will notice though, that you have the option of taking a snapshot before you apply the snapshot. That way, you can revert your machine to its original state at the time that the snapshot was made, but you have the option of rolling the virtual machine forward to the state that it is in right now.

Keep in mind that simply applying the snapshot does not cause the snapshot to be deleted. The snapshot remains in place in case you want to have another go at the operation that caused the failure to occur. If you want to delete a snapshot, you will have to do so manually.

Deleting a Snapshot

Whether you decide to apply a snapshot or not, you are eventually going to want to delete your snapshots so that the virtual machine’s performance can be returned to normal. The most important thing to know about deleting snapshots is that doing so does not cause data loss. Deleting a snapshot simply removes your ability to apply that snapshot. Any data that is associated with the snapshot is merged with the virtual machine.

Microsoft gives you a couple of different options for deleting snapshots. If you only want to delete a single snapshot, then you should just select the snapshot that you want to delete, and then click the Delete Snapshot option found in the lower portion of the Actions pane. If you want to delete all of the snapshots, then select the top level of the snapshot hierarchy, and then click the Delete Snapshot Subtree option.

When you delete snapshots, the snapshots will disappear almost immediately. Even though the Hyper-V Manager no longer shows the snapshots though, they still exist on disk. The .AVHD files will remain on disk until you either reboot the virtual machine or put it into a saved state. It is extremely important that you do not delete these snapshot files manually from outside of the Hyper-V Manager.

Conclusion

As you can see, working with snapshots is fairly straightforward. Even so, it is important to remember that snapshots are not true backups. In the next article in this series, I will begin exploring some of the other options in order to protect your virtual machines.

If you would like to read the next parts of this article series please go to:

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top