Introduction
When working with Azure Virtual Machines (VMs), understanding storage options is essential. Here’s a straightforward guide to Azure VM storage, covering the basics and beyond.
Types of Disks in Azure Virtual Machines
Each Azure VM has two or more disks:
- OS Disk: This is the main disk where the operating system is installed. It is essential for booting up and running the VM.
- Temporary Disk:
- Not all VM SKUs include a temporary disk.
- Content stored on this disk can be lost during VM reboots or maintenance.
- It is best suited for temporary data or caching purposes, not for critical storage.
- Data Disks (Optional):
- Additional disks can be attached to a VM for storing application data, databases, or other workloads.
- The number of data disks we can attach depends on the VM size.
Where Do These Disks Reside?
OS and Data Disks Reside in Azure Storage Accounts:
Azure storage provides robust and scalable storage options for OS and data disks. These include:
- Standard Storage:
- Standard HDD: Cost-effective but slower performance. Suitable for development and testing.
- Standard SSD: Balances performance and cost. Ideal for web servers and lightly used applications.
- Premium Storage:
- Premium SSD: High-performance, low-latency storage. Best for mission-critical workloads.
- Ultra Disk Storage:
- Ultra SSD: Delivers extremely high throughput and low latency for demanding applications like databases and analytics.
Managed Disks
Azure VMs primarily use Managed Disks, a simplified and scalable disk management option. Here’s why they matter:
- No Storage Account Management: With managed disks, we don’t need to worry about managing storage accounts to hold the disks.
- Enhanced Reliability: Azure automatically handles replication and backup of managed disks, ensuring data durability.
- Scalability: Easily create thousands of disks in an Azure subscription without hitting the limits of storage accounts.
- Types of Managed Disks:
- Standard HDD
- Standard SSD
- Premium SSD
- Ultra SSD
Steps to Add a Disk to a Virtual Machine
- Log in to the Azure portal at https://portal.azure.com and navigate to our VM.
- Under the VM’s settings, select Disks.
- Add a New Disk: Click Add Data Disk and from the dropdown menu, choose Create disk.
- Configure the New Disk:
- Provide Disk name.
- Select the desired Storage type from the dropdown, which includes categories like Locally Redundant (Standard HDD, Standard SSD, Premium SSD) and Zone Redundant (Standard SSD, Premium SSD). Choose the appropriate option based on your workload requirements. Ultra Disks become available only for specific VM sizes, regions, and availability zones, and must be explicitly enabled with customizable performance parameters.
- Specify the disk size. E.g. 4 GiB.
- For Encryption, select the appropriate option based on your security requirements. E.g. Platform managed key.
- For Host caching, select the appropriate option (e.g., Read-only) based on your performance needs. Options include None (no caching), Read-only (for frequent reads), and Read/Write (for mixed workloads).
- Click Save to create and attach the disk.
- Initialize and Format the Disk in the VM:
- Navigate to the taskbar of the VM, search for, and select diskmgmt.msc (Disk Management).
- In the Initialize Disk screen, select the new disk.
- Choose the partition style:
- GPT (GUID Partition Table): Recommended for most scenarios.
- MBR (Master Boot Record): An alternative option for older systems.
- Click OK to initialize the disk.
- Create a New Simple Volume:
- The new disk will currently appear as unallocated. Right-click on the unallocated space and select New Simple Volume.
- Follow the New Simple Volume Wizard:
- Optionally, adjust the simple volume size or keep it as default.
- Assign a drive letter of your choice.
- Choose the radio button Format this volume with the following settings and use the default options:
- File system: NTFS
- Allocation unit size: Default
- Volume Label: New Volume
- Ensure Perform a quick format is selected.
- Leave Enable file and folder compression unchecked.
- Click Next, review your settings, and click Finish to create and format the volume.
- Verify the Disk:
- Ensure the new disk is properly formatted and accessible from the VM.
- We can now use it for storage.
Additional Features to Consider
- Snapshot Backups: We can create snapshots of our managed disks for backup or cloning purposes.
- Disk Encryption:
- Azure Disk Encryption ensures data security using encryption-at-rest with Azure Key Vault.
- We can use customer-managed keys for greater control.
- Zonal Redundancy:
- Managed disks can be configured with zonal redundancy, ensuring data remains available even if a zone becomes unavailable.
- Shared Disks:
- Managed disks can be shared across multiple VMs for clustered or distributed applications.
Choosing the Right Storage for Our VM
When selecting a storage type for our Azure VM, consider the following:
- Workload Requirements:
- Development/Test: Standard HDD or Standard SSD
- Web Servers/Light Apps: Standard SSD
- Production Applications: Premium SSD or Ultra SSD
- Performance Needs:
- Throughput-intensive applications benefit from Ultra SSD.
- Balanced applications can leverage Premium SSD or Standard SSD.
- Cost:
- Budget-conscious deployments may prefer Standard HDD or SSD.
- Mission-critical workloads justify the higher cost of Premium or Ultra SSD.
Conclusion
Azure Virtual Machines offer versatile and scalable storage options, from basic Standard HDD to ultra-high-performance Ultra SSD. By understanding the different types of disks, where they reside, and their unique features, we can optimize our VM storage to suit our application’s needs.