snapshot

Azure Portal | Playing with Disk Snapshot

Azure Portal | Playing with Disk Snapshot

Disk Snapshot is a powerful tool to manage Azure VMs. It’s simple to create and can help the administrators in various tasks. It’s a fast and efficient way to have a crash-consistent Disk of a Virtual Machine, before performing tasks, updates, configuration changes, application installations, etc. Of course the last line of defence is the Azure Backup, but using the Snapshot you don’t need to wait the whole Backup / Restore times. With snapshots there are two main options to recover the VM. One is using the “swap OS Disk” functionality, which gives you the ease to swap the Operating System disk with one click. The other option is to create a new VIrtual Machine. Beware, if you want to make Azure VM clones, you need to generalize the VM with Sysprep and Capture the VM. Using the Snapshot option you will have an identical VM, with the same IDs.

Snapshot

The first step is to create a snapshot from the Virtual Disk. Open the Azure VM, go to Disks, select the OS Disk and press “Create Snapshot”. You don’t actually need to stop the VM. Windows Server operating system stays fully consistent, but no one can guarantee the consistency of any databases currently running. Think of it like the Hyper V CheckPoint functionality. We make checkpoints all the time and we revert to them even in production.

disk snapshot

The Create snapshot screen will open. Fill in a name and disk account type (Standard / Premium) and press create.

disk snapshot

At this point I will create a folder at the VM for revision

disk snapshot

Create a Disk

To make the snapshot functional, we need to create a Managed Disk resource.

disk snapshot

At the Create managed disk wizard, select the Region that the Snapshot resides. Then select “Source type” Snapshot and select it. At the Size, select a disk size at least the same as the source disk.

disk snapshot

Swap OS Disk

Now that we have created the managed disk, it’s time to use the Swap OS Disk functionality. We have proceeded with the Azure VM’s updates, software updates, configuration changes, and finally we need to roll back those changes. Go to the VM’s Disks and press “Swap OS Disk”

disk snapshot

at the “Swap OS Disk” wizard, select the managed disk that we created.

disk snapshot

In the background, the Azure Platform will stop, deallocate the VM and it will re-crate it with the selected OS disk. As you see at the next screenshot the OS disk is the managed disk that we created from teh snapshot.

disk snapshot

I Started the VM and logged in. The folder I created after the snapshot of course is missing 🙂

disk snapshot

New Azure VM

The other option is to create a new Virtual Machine using the Snapshot. As I wrote before, beware, if you want to make Azure VM clones, you need to generalize the VM with Sysprep and Capture the VM. Using the Snapshot option you will have an identical VM, with the same IDs.

To create a VM from the Snapshot, just open the Managed Disk that you created from the Snapshot and press Create VM.

disk snapshot

The Create a virtual machine wizard will open, and at the Operating System Image section, it will have selected the image from the disk. This process is identical to creating a new Hyper V VM from an existing virtual disk.

disk snapshot

Follow the Create a virtual machine wizard exactly the same as creating any Azure VM.

More e-apostolidis.gr posts about managed disks: https://www.e-apostolidis.gr/tag/managed-disks/

Read more at: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/managed-disks-overview#managed-disk-snapshots

 

Share

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.