Azure Documentation

Resizing Azure Managed Disks

This document explains how to resize Azure Managed Disks, including considerations and best practices.

Introduction

Azure Managed Disks offer a flexible way to manage storage for your virtual machines. You can resize disks to accommodate changing storage needs without significant downtime.

When to Resize a Disk

Methods for Resizing

You can resize Azure Managed Disks using the Azure portal, Azure CLI, or Azure PowerShell.

Using the Azure Portal

  1. Navigate to your virtual machine or the disk resource directly.
  2. Under the Settings section, select Disks.
  3. Click on the disk you wish to resize.
  4. In the disk's Overview page, find the Size option.
  5. Select a new size from the available options. The portal will show available sizes and their corresponding performance characteristics.
  6. Click Resize to confirm the change.

Using Azure CLI

To resize a disk using Azure CLI, you can use the az disk update command. Ensure the VM is deallocated if you are resizing the OS disk.


az disk update --resource-group <YourResourceGroupName> --name <YourDiskName> --size-gb <NewSizeInGB>
            

Replace <YourResourceGroupName>, <YourDiskName>, and <NewSizeInGB> with your specific values.

Using Azure PowerShell

Use the Update-AzDisk cmdlet in Azure PowerShell.


Update-AzDisk -ResourceGroupName <YourResourceGroupName> -DiskName <YourDiskName> -DiskSizeGB <NewSizeInGB>
            

Again, replace the placeholders with your actual resource group name, disk name, and desired new size.

Important Considerations

Note: Resizing an OS disk often requires the virtual machine to be deallocated. Data disks can typically be resized while the VM is running, but it's always recommended to stop the VM for critical operations to avoid data corruption.
Important: You can only increase the size of a disk. To decrease the size, you must create a new, smaller disk and migrate your data.
Tip: After resizing a disk, you may need to extend the partition within the operating system to utilize the newly added space. This is a common step for both OS and data disks.

Performance Tiers and Resizing

Resizing a disk often involves changing its performance tier. For example, increasing the size of a Standard HDD might allow you to upgrade to Standard SSD or Premium SSD for better IOPS and throughput.

Refer to the Disk Performance Tiers documentation for detailed specifications.

Extending Partitions within the OS

After resizing a disk in Azure, the operating system may not automatically recognize the new space. You will need to extend the partition within the OS.

For Windows:

  1. Open Disk Management (diskmgmt.msc).
  2. Right-click on the volume you want to extend.
  3. Select Extend Volume and follow the wizard.

For Linux:

The process varies depending on the Linux distribution and disk partitioning tool (e.g., parted, fdisk, growpart).


# Example using growpart (often available on cloud images)
sudo growpart /dev/sdX Y
# Then extend the filesystem
sudo resize2fs /dev/sdXY # For ext4
sudo xfs_growfs /mount/point # For XFS
            

Always consult your specific Linux distribution's documentation for the most accurate commands.

Troubleshooting Resizing Operations

If you encounter issues during resizing: