Manage Azure Managed Disks

This document provides instructions and best practices for managing Azure Managed Disks. Managed Disks simplify disk management by handling storage account management, redundancy, and data distribution.

Key Management Operations

You can manage your managed disks through the Azure portal, Azure CLI, Azure PowerShell, or REST APIs. Common management tasks include:

Resizing Disks

You can resize a managed disk to accommodate growing storage needs. This operation requires the disk to be detached from any VM.

Tip: You can resize a disk while it's attached to a VM for certain disk types (e.g., Ultra Disks), but it's generally recommended to detach for consistency.

Using Azure CLI to Resize


az disk update --resource-group MyResourceGroup --name MyDisk --size-gb 2048
            

Using Azure PowerShell to Resize


Update-AzDisk -ResourceGroupName "MyResourceGroup" -DiskName "MyDisk" -DiskSizeGB 2048
            

Changing Disk SKU (Performance Tier)

Managed disks offer different performance tiers (Standard HDD, Standard SSD, Premium SSD, Ultra Disk). You can change the SKU to match your application's performance requirements.

SKU Description Use Case
Standard HDD Lowest cost, suitable for dev/test, backup, non-critical workloads. Infrequent access, low IOPS requirement.
Standard SSD Balanced cost and performance, suitable for web servers, lightly trafficked applications. Consistent latency, moderate IOPS.
Premium SSD High performance, low latency, suitable for production workloads. Mission-critical applications, databases, high IOPS.
Ultra Disk Highest performance, configurable IOPS and throughput, for demanding workloads. High-performance databases, AI/ML workloads.

Using Azure CLI to Change SKU


az disk update --resource-group MyResourceGroup --name MyDisk --sku Premium_LRS
            

Managing Disk Encryption

All managed disks are encrypted at rest by default using Azure Storage Service Encryption (SSE). You can also use Customer-Managed Keys (CMK) for enhanced control.

For detailed information on encryption, refer to the Disk Encryption documentation.

Deleting Disks

When deleting a managed disk, ensure it is not attached to any VM. Deleting a disk is irreversible and will result in data loss.

Warning: Before deleting a disk, verify that no critical data is stored on it or that you have appropriate backups or snapshots.

Using Azure CLI to Delete


az disk delete --resource-group MyResourceGroup --name MyDisk
            

Best Practices for Managed Disk Management

Disk Operations and VM State

Several disk management operations require the disk to be detached from the VM. These include:

Ensure you detach the disk from the VM, perform the operation, and then reattach the disk.

Note: Ultra Disks and Premium SSDs offer more flexibility with attached operations for certain scenarios. Consult specific documentation for these disk types.