This document provides comprehensive guidance on managing Azure Managed Disks, a key component for virtual machines and other Azure services requiring persistent storage.
Azure Managed Disks simplify storage management by abstracting away the underlying storage accounts. They are highly available, durable, and scalable. Key benefits include:
Azure offers several disk types to meet different performance and cost requirements:
You can create managed disks using the Azure portal, Azure CLI, PowerShell, or ARM templates.
To create a Standard SSD managed disk:
az disk create --resource-group MyResourceGroup --name MyDisk --sku StandardSSD_LRS --size-gb 128
To create a Premium SSD managed disk with specific IOPS and throughput:
az disk create --resource-group MyResourceGroup --name MyPremiumDisk --sku Premium_LRS --size-gb 256 --set-disk-performance --disk-iops-ps 4000 --disk-throughput-mbps 120
Managed disks can be attached to Azure Virtual Machines as data disks or OS disks. Ensure the VM and the disk are in the same Azure region and availability zone.
To attach a disk to a VM:
az vm disk attach --resource-group MyResourceGroup --vm-name MyVM --name MyDisk --new --sku StandardSSD_LRS
You can resize a managed disk without downtime if it's not attached to a running VM. If attached, the VM must be stopped (deallocated).
To resize a disk:
az disk update --resource-group MyResourceGroup --name MyDisk --size-gb 256
Detaching a disk from a VM is a straightforward process.
To detach a disk:
az vm disk detach --resource-group MyResourceGroup --vm-name MyVM --name MyDisk
Managed disks can be deleted when they are no longer needed. Ensure they are detached from any VMs.
To delete a disk:
az disk delete --resource-group MyResourceGroup --name MyDisk
Managed disks support creating snapshots for backup and disaster recovery purposes. You can also create custom images from managed disks to deploy identical VMs.
az snapshot create --resource-group MyResourceGroup --name MyDiskSnapshot --source MyDisk
az image create --resource-group MyResourceGroup --name MyCustomImage --source MyDisk
All managed disks are encrypted at rest by default using Azure Storage Service Encryption (SSE) with platform-managed keys. You can also use customer-managed keys for enhanced control.
Choose the appropriate disk type based on your application's IOPS (Input/Output Operations Per Second) and throughput requirements. Monitor disk performance metrics in the Azure portal.
| Disk Type | Typical Use Cases | Performance Characteristics |
|---|---|---|
| Ultra Disks | High-performance databases, mission-critical applications | High IOPS and throughput, lowest latency |
| Premium SSDs | Production applications, I/O-intensive workloads | Consistent IOPS and throughput, low latency |
| Standard SSDs | Web servers, dev/test environments | Balanced performance and cost |
| Standard HDDs | Backup, archive, infrequent access | Lowest cost, higher latency |