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 reconstructs the full disk that 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 don't 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 HDD storage, irrespective of the storage type of the disk, whereas full snapshots can use premium SSDs. If you're using full snapshots on Premium Storage to scale up VM deployments, we recommend you use custom images on standard storage in the Azure Compute 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 isn't 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 don't recommend that.

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

  • Not currently available for Premium SSD v2 managed disks.
  • Incremental snapshots currently can't 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 can't create an incremental snapshot for a particular disk outside of that disk's subscription.
  • Incremental snapshots can't be moved to another resource group. But, they can be copied to another resource group or region.
  • Up to seven incremental snapshots per disk can be created every five minutes.
  • A total of 500 incremental snapshots can be created for a single disk.
  • You can't 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 can't get the changes between snapshot-a and snapshot-b. You have to 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.

Incremental snapshots of Ultra Disks (preview)

Incremental snapshots of Ultra Disks have the following extra restrictions:

  • You must request and receive access to the preview from the following link: https://aka.ms/UltraPremiumv2SnapshotPreview
  • Currently only available in Sweden Central and US West 3.
  • Snapshots with a 512 logical sector size are stored as VHD, and can be used to create any disk type. Snapshots with a 4096 logical sector size are stored as VHDX and can only be used to create Ultra Disks, they can't be used to create other disk types. To determine which sector size your snapshot is, see check sector size.
  • When an incremental snapshot of an Ultra Disk is created, a background copy process for that disk is started. While a background copy is ongoing, you can have up to three total snapshots pending. The process must complete before any more snapshots of that disk can be created.
  • Incremental snapshots of an Ultra disk can't be used immediately after they're created. The background copy must complete before you can create a disk from the snapshot. See Check status of snapshots or disks for details.
  • Disks created from an incremental snapshot of an Ultra Disk can't be immediately attached to a VM once it's created. The background copy must complete before it can be attached. See Check disk creation status for details.

You can use the Azure CLI to create an incremental snapshot. You'll 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

Important

After taking a snapshot of an Ultra Disk, you must wait for the snapshot to complete before you can use it. See the Check status of snapshots or disks section for details.

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

Check status of snapshots or disks

Incremental snapshots of Ultra Disks (preview) can't be used to create new disks until the background process copying the data into the snapshot has completed. Similarly, Ultra Disks created from incremental snapshots can't be attached to a VM until the background process copying the data into the disk has completed.

You can use either the CLI or PowerShell sections to check the status of the background copy from a disk to a snapshot and you can use the Check disk creation status section to check the status of a background copy from a snapshot to a disk.

CLI

You have two options for getting the status of snapshots. You can either get a list of all incremental snapshots associated with a specific disk, and their respective status, or you can get the status of an individual snapshot.

CLI - List incremental snapshots

The following script returns a list of all snapshots associated with a particular disk. The value of the CompletionPercent property of any snapshot must be 100 before it can be used. Replace yourResourceGroupNameHere, yourSubscriptionId, and yourDiskNameHere with your values then run the script:

# 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

CLI - Individual snapshot

You can also check the status of an individual snapshot by checking the CompletionPercent property. Replace $sourceSnapshotName with the name of your snapshot then run the following command. The value of the property must be 100 before you can use the snapshot for restoring disk or generate a SAS URI for downloading the underlying data.

az snapshot show -n $sourceSnapshotName -g $resourceGroupName --query [completionPercent] -o tsv

PowerShell

You have two options for getting the status of snapshots. You can either get a list of all incremental snapshots associated with a particular disk and their respective status, or you can get the status of an individual snapshot.

PowerShell - List incremental snapshots

The following script returns a list of all incremental snapshots associated with a particular disk that haven't completed their background copy. Replace yourResourceGroupNameHere and yourDiskNameHere, then run the script.

$resourceGroupName = "yourResourceGroupNameHere"
$snapshots = Get-AzSnapshot -ResourceGroupName $resourceGroupName
$diskName = "yourDiskNameHere"

$yourDisk = Get-AzDisk -DiskName $diskName -ResourceGroupName $resourceGroupName

$incrementalSnapshots = New-Object System.Collections.ArrayList

foreach ($snapshot in $snapshots)
{
    if($snapshot.Incremental -and $snapshot.CreationData.SourceResourceId -eq $yourDisk.Id -and $snapshot.CreationData.SourceUniqueId -eq $yourDisk.UniqueId)
    {
    $targetSnapshot=Get-AzSnapshot -ResourceGroupName $resourceGroupName -SnapshotName $snapshotName
        {
        if($targetSnapshot.CompletionPercent -lt 100)
            {
            $incrementalSnapshots.Add($targetSnapshot)
            }
        }
    }
}

$incrementalSnapshots

PowerShell - individual snapshots

You can check the CompletionPercent property of an individual snapshot to get its status. Replace yourResourceGroupNameHere and yourSnapshotName then run the script. The value of the property must be 100 before you can use the snapshot for restoring disk or generate a SAS URI for downloading the underlying data.

$resourceGroupName = "yourResourceGroupNameHere"
$snapshotName = "yourSnapshotName"

$targetSnapshot=Get-AzSnapshot -ResourceGroupName $resourceGroupName -SnapshotName $snapshotName

$targetSnapshot.CompletionPercent

Check disk creation status

When creating a disk from an Ultra Disk snapshot, you must wait for the background copy process to complete before you can attach it. Currently, you must use the Azure CLI to check the progress of the copy process.

The following script gives you the status of an individual disk's copy process. The value of completionPercent must be 100 before the disk can be attached.

subscriptionId=yourSubscriptionID
resourceGroupName=yourResourceGroupName
diskName=yourDiskName

az account set --subscription $subscriptionId

az disk show -n $diskName -g $resourceGroupName --query [completionPercent] -o tsv

Check sector size

Snapshots with a 4096 logical sector size can only be used to create Ultra Disks. They can't be used to create other disk types. Snapshots of disks with 4096 logical sector size are stored as VHDX, whereas snapshots of disks with 512 logical sector size are stored as VHD. Snapshots inherit the logical sector size from the parent disk.

To determine whether or your Ultra Disk snapshot is a VHDX or a VHD, get the LogicalSectorSize property of the snapshot.

The following command displays the logical sector size of a snapshot:

az snapshot show -g resourcegroupname -n snapshotname --query [creationData.logicalSectorSize] -o tsv

Next steps

See Copy an incremental snapshot to a new region to learn how to copy an incremental snapshot across regions.

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.