Azure – You can now expand your data drive without downtime (preview)

If you run Azure virtual machines, you already know that you expand your data drives after shutting down (deallocate) the virtual machine.

Well, good news, you can now do the same without downtime.

Before you start expanding your drives while your virtual machine is still running, you need to know the following:

  • This capability is only supported for data drives; for OS drive you still need to shutdown the VM
  • Ultra disks and shared disks are not supported by this capability

Well, now how to you expand your drives?

Frist you need to register the LiveResize feature of the Microsoft.Compute provider using either PowerShell or Azure Cli:

  • Azure Cli

az feature register –namespace Microsoft.Compute –name LiveResize

  • Azure PowerShell

Register-AzProviderFeature -FeatureName “LiveResize” -ProviderNamespace “Microsoft.Compute”

image

NOTE it may take sometime to complete the registration, so I would recommend you enable it right now even if you don’t need this feature immediately.

Then you can resize your disk using either the Azure portal, PowerShell or Azure Cli

  • Azure Cli

az disk list –resource-group ‘resource group hosting the VM’ –query ‘[*].{Name:name,Gb:diskSizeGb,Tier:accountType}’ –output table

az disk update –resource-group ‘resource group hosting the VM’–name ‘disk name’–size-gb ‘new size of the disk’

  • PowerShell

$rgName = ‘resource group hosting the VM’

$diskName = ‘disk name’

$disk= Get-AzDisk -ResourceGroupName $rgName -DiskName $diskName

$disk.DiskSizeGB = ‘new size of the disk’

Update-AzDisk -ResourceGroupName $rgName -Disk $disk -DiskName $disk.Name

image

  • Azure Portal
    • Access the virtual machine disk blade to select the data drive you want to expand using the Size+perfomance blade

image  image  image  image

NOTE the expand operation can take some time to complete.

Once the disk has been expanded you now extend your file system in the VM.

Leave a Comment

Your email address will not be published. Required fields are marked *