Choosing a Disk Type
Azure offers several managed disk types, each with different performance and cost characteristics. You choose a disk based on your workload's needs for speed, consistency, and budget. Standard HDD disks are the lowest-cost option for workloads that can tolerate higher latency, like backups or infrequently accessed data. Standard SSD disks offer better reliability and performance than HDDs at a moderate cost, suitable for web servers or lightly used applications. Premium SSD disks deliver high performance with low latency and are designed for production workloads like databases.
Using Ultra Disks
Azure Ultra Disks are a high-performance tier designed for the most demanding data-intensive workloads, such as SAP HANA or top-tier databases. Their major benefit is the ability to dynamically adjust performance settings like IOPS and throughput without needing to restart the attached virtual machine (VM). You can make these adjustments up to four times within a 24-hour period directly from the Azure portal under the disk's "Size + performance" settings.
Enabling and Attaching Ultra Disks
Before you can use an Ultra Disk, the VM must have Ultra Disk compatibility enabled. This requires stopping the VM, updating its configuration using PowerShell to set UltraSSDEnabled to $True, and then restarting the VM. Once enabled, you create and attach the Ultra Disk using PowerShell commands like New-AzDisk to define its performance and Add-AzVMDataDisk to connect it to the VM.
Ultra Disk Limitations
Ultra Disks have important limitations that affect how you can use them. They cannot be used as an operating system (OS) disk or with Azure Compute Gallery. They only support deployment to a single VM within an availability zone and do not work with availability sets. You cannot convert an existing disk of another type into an Ultra Disk. Additionally, Ultra Disks do not support disk caching or Azure Disk Encryption.
Implement Core Disk Management Operations
Disk Roles and Attachment
An Azure VM uses three primary disk roles. The OS disk contains the operating system and is attached when the VM is created. Data disks are used for storing application data, and you can attach multiple data disks depending on the VM's size. A temporary disk provides short-term storage but is not persistent. You can attach a new data disk to a VM during creation or afterward. Once attached, you must initialize, partition, and format the disk inside the VM's operating system before it can be used.
Expanding Disk Capacity
You can expand the capacity of both OS and data disks to meet growing storage needs. For data disks, you can perform a live resize without stopping the VM. Expanding an OS disk, however, requires you to stop (deallocate) the VM first. After resizing the disk in Azure, you must extend the partition and file system within the VM's OS to use the new space.
Understanding Disk Caching
Disk caching settings can significantly impact input/output (I/O) performance by storing frequently accessed data in the VM's memory. The main options are ReadOnly, ReadWrite, and None. For data disks that handle frequent read operations, ReadOnly caching is recommended. For write-heavy workloads, like database log files, setting caching to None often provides the best performance. It is important to note that Ultra Disks do not support caching at all.
Creating Snapshots and Backups
A snapshot is a point-in-time, read-only copy of a disk used for backup and disaster recovery. Snapshots can be full or incremental, meaning they only store changes since the last snapshot. For multi-disk VMs, you need application-consistent snapshots, which coordinate across all disks to ensure data integrity. A higher-level backup option is a VM Restore Point, which captures all managed disks attached to a VM at once. Azure Disk Backup is a managed service that automates periodic, incremental snapshots according to a policy you define.
Secure and Optimize Disk Data with Advanced Features
Applying Azure Disk Encryption
Azure Disk Encryption (ADE) protects data at rest by providing full disk encryption for both OS and data disks. For Windows VMs, it uses BitLocker, and for Linux, it uses DM-Crypt. ADE integrates with Azure Key Vault to securely store and manage the encryption keys. You can choose to let Azure manage the keys or use your own customer-managed keys for greater control. This encryption travels with the disk, meaning snapshots and disks created from encrypted sources remain encrypted.
Configuring Server-Side and Host Encryption
Beyond ADE, Azure offers other encryption layers. Server-Side Encryption (SSE) encrypts data automatically when it is stored on Azure's physical disks. You can use platform-managed keys or bring your own customer-managed keys from Key Vault. Encryption at host provides end-to-end encryption by encrypting data on the VM host itself before it is written to storage. This method can offer performance benefits and also encrypts temporary disks and caches, but it cannot be used at the same time as ADE on the same VM.
Managing Access with RBAC
You control who can manage disks and their encryption keys using Azure role-based access control (RBAC). By assigning specific roles to users, groups, or applications, you can limit permissions to actions like attaching disks, creating snapshots, or accessing keys in Key Vault. This is crucial for enforcing security policies and meeting compliance requirements by ensuring only authorized personnel can perform sensitive disk operations.
Moving Disks and Optimizing for HA
You can move disks between resource groups or subscriptions, which is useful for reorganizing resources. For high-availability solutions, you can configure shared disks. This feature allows an Azure managed disk to be attached to multiple VMs simultaneously in a cluster configuration, which is necessary for workloads like Windows Server Failover Clustering or clustered databases. To protect against zonal failures, you can use zone-redundant storage (ZRS) for your disks and deploy VMs across availability zones.