Azure Virtual Machines Storage

Deep dive into managing storage for your Azure VMs

This document provides a comprehensive guide to understanding and managing storage options for Azure Virtual Machines (VMs). Efficient storage management is crucial for performance, cost optimization, and data durability.

Types of VM Storage

Azure offers several types of storage for VMs, each with different characteristics suited for various workloads:

1. Managed Disks

Managed Disks are the recommended storage solution for Azure VMs. They are block-level storage volumes that are managed by Azure. You only need to manage the disks themselves, not the underlying storage infrastructure.

  • OS Disks: Used to install the operating system.
  • Data Disks: Used to store application data and files.

Disk Types for Managed Disks:

Disk Type Description Use Case Performance (IOPS/Throughput)
Ultra Disk Highest performance, lowest latency, configurable IOPS and throughput. Mission-critical, I/O-intensive applications, top-tier databases. Up to 128K IOPS, 2 GB/s throughput per disk.
Premium SSD High performance, low latency SSD-based storage. Production and test workloads requiring consistent I/O performance. Up to 20K IOPS, 900 MB/s throughput per disk (varies by size).
Standard SSD Consistent performance at a lower cost than Premium SSD. Web servers, lightly used applications, dev/test environments. Up to 600 IOPS, 120 MB/s throughput per disk (varies by size).
Standard HDD Lowest cost, magnetic-based storage for infrequent access. Backup, disaster recovery, non-critical data, archival. Up to 500 IOPS, 60 MB/s throughput per disk (varies by size).

2. Unmanaged Disks

Unmanaged Disks are an older storage option where you are responsible for managing the storage accounts and VHD files that back your VM disks. It is generally recommended to use Managed Disks.

Key Concepts and Best Practices

Disk Caching

Disk caching can significantly improve read performance for your VMs. You can configure caching at the disk level:

  • None: No caching enabled.
  • Read-only: Caches read requests. Suitable for most data disks.
  • Read-write: Caches both read and write requests. Best for OS disks to improve boot times and OS responsiveness.
Tip: For OS disks, Read-write caching is generally recommended for better performance. For data disks, Read-only is often sufficient and safer if the application doesn't handle data corruption gracefully.

Disk Encryption

Azure Disk Encryption (ADE) allows you to encrypt your OS and data disks using BitLocker (Windows) or dm-crypt (Linux). This helps protect your data at rest.

You can manage encryption keys using Azure Key Vault.

Snapshots and Images

Snapshots: Point-in-time copies of a disk. Useful for backups and troubleshooting.

Images: Custom VM images can be created from a VM's OS disk (or a managed disk) to quickly deploy identical VMs.

Note: While you can create snapshots of unmanaged disks, it's more complex than with Managed Disks. Managed Disks offer simpler snapshot management.

Storage Performance Considerations

  • Match disk type to workload requirements.
  • Consider disk bursting capabilities for burstable tiers.
  • Monitor IOPS and throughput to identify bottlenecks.
  • Use Availability Sets or Availability Zones for resilience, which includes storage redundancy.

Examples of Storage Configuration

Deploying a VM with Premium SSDs

When creating a VM, you can specify the disk type and size for your OS and data disks. For example, using Azure CLI:


az vm create \
    --resource-group MyResourceGroup \
    --name MyVM \
    --image UbuntuLTS \
    --admin-username azureuser \
    --admin-password 'MyPassword123!' \
    --size Standard_DS2_v2 \
    --data-disk-sizes-gb 100 200 \
    --storage-sku Premium_LRS
                

In this example, --storage-sku Premium_LRS specifies that the disks (OS and data) will use Premium LRS (Locally Redundant Storage).

Attaching a Standard HDD Data Disk

You can attach additional disks after VM creation:


az vm disk attach \
    --resource-group MyResourceGroup \
    --vm-name MyVM \
    --name MyDataDisk \
    --sku Standard_LRS \
    --new \
    --size-gb 500
                

This command creates a new 500GB Standard HDD disk (Standard_LRS) and attaches it to MyVM.

Important: Always format and mount new data disks within the operating system before use.

Next Steps

Explore related topics such as Azure Files, Azure NetApp Files for high-performance file shares, and shared disks for clustered applications.