Managed Disks provide persistent, secured disk storage for Azure Virtual Machines. The managed disk also provides the high availability for VMs by keeping the disks of different virtual machines in an availability set in physically separate stamps of storage. without managed disk, a storage stamp (storage cluster) can be same for all the VMs running in availability set using unmanaged disks.
Let’s understand the difference between the Managed and Unmanaged disks
UnManaged Disk –
A VM disk created with a new storage account or by using existing storage account
Managed Disk –
A VM disk created during a VM creation by selecting “Use Managed Disk” and Microsoft manages the storage account
The managed disk provides following benefits:
- Simple Deployment – No need to create a storage account
- Role Based Access to the disk – Restrict access to managed disk
- Higher Performance – by not keeping more than 40 disks in a single storage account
- Big Scale – Supports 20K disks (10 K Standard and 10 K Premium) per subscription whereas maximum storage account supported in a single Azure subscription are 250 (250 * 40 = 10 K). please also refer to Microsoft Azure subscription service limitations
- Microsoft recommended – All future disk enhancements will come in managed disk
How to migrate to managed disk
Existing VMs running with unmanaged disk can be migrated to a managed disk. This migration from unmanaged to managed disk can be done using PowerShell or using Azure CLI2.0. As of today, there is no GUI interface to convert to managed disk.
- Stop the running VM
- Run the PowerShell command to convert the VM disk to managed disk
- Automatic Start – VM will start once the migration is completed
$VMName = "VM Name"
$RGName = "Resource Group Name"
## Login to Azure RM Account
## Select an Azure Subscription
Select-AzureRMSubscription -Subscriptionname "Your Subscription Name"
##Converting an unmanaged VM disk to Managed
ConvertTo-AzureRmVMManagedDisk -ResourceGroupName $RGName -vmname $VMName
Once completed, VM will automatically start. you can verify the VM by selecting the disk and try to add new disk.
VM with Unmanaged disk – It will ask for storage container
VM with Managed Disk – No storage container required