Site icon Windows Active Directory

How to resize Microsoft Azure VM disk

In cloud computing, flexibility and scalability are critical aspects of managing resources efficiently. Azure offers a seamless way to resize your virtual machine (VM) disks to accommodate changing storage needs. This article walks you through the process step by step, ensuring smooth resizing of your Azure VM.

Evaluating disk performance

Before resizing, evaluate your Azure VM disks to determine if they are affecting performance or hampering resource availability. Available disk space and performance indicators can guide us in determining if resizing is necessary. Microsoft Azure provides valuable tools to identify disk-related issues affecting VM performance. To know what these metrics are, open your Azure VM, and in the overview section, you’ll be able to find them.

Resizing disk storage in Azure portal

 Limitations to expand without downtime 

Steps to resize Microsoft Azure VM disk

If your disk meets the requirements for resizing without downtime, skip to step 2.

  1. In the Azure portal, go to the virtual machine in which you want to expand the disk. Select Stop to deallocate the VM.
  2. In the left menu under Settings, select disks.
  3. Under Disk name, select the disk you want to expand.
  4. In the left menu under Settings, select Size + Performance.
  5. In Size + Performance, select the disk size you want or enter a custom disk size.
  6. After configuring the size, click Resize to implement the changes.

Resizing disk by using PowerShell

Connect-AzAccount

Select-AzSubscription –SubscriptionName 'my-subscription-name'

Replace ‘my-subscription-name’ with the name of your Azure subscription.

$rgName = 'my-resource-group-name'

$vmName = 'my-vm-name'

$diskName = 'my-disk-name'

Replace ‘my-resource-group-name’, ‘my-vm-name’, and ‘my-disk-name’ with your actual resource group name, VM name, and disk name.

$vm = Get-AzVM -ResourceGroupName $rgName -Name $vmName
Stop-AzVM -ResourceGroupName $rgName -Name $vmName
$disk= Get-AzDisk -ResourceGroupName $rgName -DiskName $diskName

$disk.DiskSizeGB = 1023  # Set the desired disk size in GB

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

Ensure that the new size is greater than the existing disk size. The maximum allowed size for OS disks is 4,095 GB.

Start-AzVM -ResourceGroupName $rgName -Name $vmName

Resizing disk using DiskPart

Resizing disk using Disk Manager

Restart VM

Once the disk resizing process completes, restart the virtual machine to ensure that the new disk size and performance settings take effect. Downgrading disk types (e.g., from Premium SSD to Standard HDD) may require a 24-hour waiting period after any disk changes to take effect.

Exit mobile version