Create an incremental snapshot for managed disks

Applies to: ✔️ Linux VMs ✔️ Windows VMs ✔️ Flexible scale sets ✔️ Uniform scale sets

Incremental snapshots are point in time backups for managed disks that, when taken, consist only of the changes since the last snapshot. When you restore a disk from an incremental snapshot, the system reconstruct the full disk which represents the point in time backup of the disk when the incremental snapshot was taken. This capability for managed disk snapshots potentially allows them to be more cost effective, since, unless you choose to, you do not have to store the entire disk with each individual snapshot. Just like full snapshots, incremental snapshots can be used to either create a full managed disk or a full snapshot. Both full snapshots and incremental snapshots can be used immediately after being taken. In other words, once you take either snapshot, you can immediately read the underlying VHD and use it to restore disks.

There are a few differences between an incremental snapshot and a full snapshot. Incremental snapshots will always use standard HDDs storage, irrespective of the storage type of the disk, whereas full snapshots can use premium SSDs. If you are using full snapshots on Premium Storage to scale up VM deployments, we recommend you use custom images on standard storage in the Shared Image Gallery. It will help you achieve a more massive scale with lower cost. Additionally, incremental snapshots potentially offer better reliability with zone-redundant storage (ZRS). If ZRS is available in the selected region, an incremental snapshot will use ZRS automatically. If ZRS is not available in the region, then the snapshot will default to locally-redundant storage (LRS). You can override this behavior and select one manually but, we do not recommend that.

Incremental snapshots also offer a differential capability, only available to managed disks. They enable you to get the changes between two incremental snapshots of the same managed disks, down to the block level. You can use this capability to reduce your data footprint when copying snapshots across regions. For example, you can download the first incremental snapshot as a base blob in another region. For the subsequent incremental snapshots, you can copy only the changes since the last snapshot to the base blob. After copying the changes, you can take snapshots on the base blob that represent your point in time backup of the disk in another region. You can restore your disk either from the base blob or from a snapshot on the base blob in another region.

Diagram depicting incremental snapshots copied across regions. Snapshots make various API calls until eventually forming page blobs per each snapshot.

Incremental snapshots are billed for the used size only. You can find the used size of your snapshots by looking at the Azure usage report. For example, if the used data size of a snapshot is 10 GiB, the daily usage report will show 10 GiB/(31 days) = 0.3226 as the consumed quantity.

Restrictions

  • Incremental snapshots currently cannot be moved between subscriptions.
  • You can currently only generate SAS URIs of up to five snapshots of a particular snapshot family at any given time.
  • You cannot create an incremental snapshot for a particular disk outside of that disk's subscription.
  • Up to seven incremental snapshots per disk can be created every five minutes.
  • A total of 200 incremental snapshots can be created for a single disk.
  • You cannot get the changes between snapshots taken before and after you changed the size of the parent disk across 4 TB boundary. For example, You took an incremental snapshot snapshot-a when the size of a disk was 2 TB. Now you increased the size of the disk to 6 TB and then took another incremental snapshot snapshot-b. You cannot get the changes between snapshot-a and snapshot-b. You have to again download the full copy of snapshot-b created after the resize. Subsequently, you can get the changes between snapshot-b and snapshots created after snapshot-b.

You can use the Azure CLI to create an incremental snapshot. You will need the latest version of the Azure CLI. See the following articles to learn how to either install or update the Azure CLI.

The following script will create an incremental snapshot of a particular disk:

# Declare variables
diskName="yourDiskNameHere"
resourceGroupName="yourResourceGroupNameHere"
snapshotName="desiredSnapshotNameHere"

# Get the disk you need to backup
yourDiskID=$(az disk show -n $diskName -g $resourceGroupName --query "id" --output tsv)

# Create the snapshot
az snapshot create -g $resourceGroupName -n $snapshotName --source $yourDiskID --incremental true

You can identify incremental snapshots from the same disk with the SourceResourceId property of snapshots. SourceResourceId is the Azure Resource Manager resource ID of the parent disk.

You can use SourceResourceId to create a list of all snapshots associated with a particular disk. Replace yourResourceGroupNameHere with your value and then you can use the following example to list your existing incremental snapshots:

# Declare variables and create snapshot list
subscriptionId="yourSubscriptionId"
resourceGroupName="yourResourceGroupNameHere"
diskName="yourDiskNameHere"

az account set --subscription $subscriptionId

diskId=$(az disk show -n $diskName -g $resourceGroupName --query [id] -o tsv)

az snapshot list --query "[?creationData.sourceResourceId=='$diskId' && incremental]" -g $resourceGroupName --output table

Cross-region snapshot copy (preview)

You can use the CopyStart option (preview) to initiate a copy of incremental snapshots from one region to any region of your choice. Azure handles the process of copying the incremental snapshots and ensures that only delta changes since the last snapshot are copied to the target region, reducing the data footprint. Customers can check the progress of the copy so they can know when a target snapshot is ready to restore disks in the target region. You can use this process to copy snapshots to another subscription for long-term retention. You can also use this to copy snapshots in the same region, to ensure that snapshots are fully hardened on zone-redundant storage and ensure that snapshots are available in the event of a zonal failure.

Diagram of Azure orchestrated cross-region copy of incremental snapshots via the Clone option.

Pre-requisites

You need to enable the feature on your subscription to use the preview feature. Use the following command to register the feature:

az feature register --namespace Microsoft.Compute --name CreateOptionClone

It may take a few minutes for registration to complete, you can use the following command to check its status:

az feature show --namespace Microsoft.Compute --name CreateOptionClone

Restrictions

  • Cross-region snapshot copy is currently only available in East US 2 and West Central US.
  • You must use version 2020-12-01 or newer of the Azure Compute Rest API.

Get started

subscriptionId=<yourSubscriptionID>
resourceGroupName=<yourResourceGroupName>
name=<targetSnapshotName>
sourceSnapshotResourceId=<sourceSnapshotResourceId>
targetRegion=<validRegion>

az login
az account set --subscription $subscriptionId
az group deployment create -g $resourceGroupName \
--template-uri https://raw.githubusercontent.com/Azure-Samples/managed-disks-powershell-getting-started/master/CrossRegionCopyOfSnapshots/CopyStartIncrementalSnapshots.json \
--parameters "name=$name" "sourceSnapshotResourceId=$sourceSnapshotResourceId" "targetRegion=$targetRegion"
az resource show -n $name -g $resourceGroupName --namespace Microsoft.Compute --resource-type snapshots --api-version 2020-12-01 --query [properties.completionPercent] -o tsv

Next steps

If you'd like to see sample code demonstrating the differential capability of incremental snapshots, using .NET, see Copy Azure Managed Disks backups to another region with differential capability of incremental snapshots.