Edit

Can't extend a volume on an Azure Windows VM

Applies to: ✔️ Windows VMs

Summary

This article helps you troubleshoot scenarios where you can't extend a disk volume at the guest operating system (OS) level on an Azure Windows virtual machine (VM). After you resize a managed disk in the Azure portal, you still need to extend the volume inside the VM. Several conditions can prevent this step from succeeding.

Note

If you receive an error when you try to resize the disk itself in the Azure portal (before reaching the guest OS), see Troubleshoot Azure VM disk resize errors instead.

Note

For SQL Server VMs deployed from Azure Marketplace, the storage pool configuration prevents standard volume extension. Use the SQL Server configuration menu in the Azure portal instead. For details, see Can't extend the volume on a SQL Server-based standalone server VM.

Symptoms

After you resize a managed disk in the Azure portal, one of the following issues occurs inside the VM:

  • The "Extend Volume" option is greyed out in Disk Management even though unallocated space is visible on the disk.
  • The volume doesn't extend to the full disk size and stops at a smaller size than expected.
  • The "Save" button is greyed out when you try to resize the disk in the Azure portal.
  • An error message appears when you try to extend the volume, such as "The volume cannot be extended because of the number of clusters."

Causes

The following conditions can prevent you from extending a volume on a Windows VM.

Cause 1: NTFS allocation unit size limits

The NTFS file system has a maximum volume size that depends on the allocation unit size (also called cluster size or "Bytes Per Cluster"). If you format the volume with a small allocation unit size, you can't extend it beyond a certain limit.

Allocation unit size Maximum NTFS volume size
4 KB (default) 16 TB
8 KB 32 TB
16 KB 64 TB
32 KB 128 TB
64 KB 256 TB

Cause 2: Recovery partition blocks extension

A recovery partition might be located between the OS volume and the unallocated space on the disk. Because you can only extend volumes into adjacent unallocated space, the recovery partition prevents the OS volume from expanding.

Cause 3: MBR partition style limits disk to 2 TB

If the disk uses the Master Boot Record (MBR) partition style, the maximum partition size is 2 TB. The GUID Partition Table (GPT) partition style doesn't have this limitation.

Cause 4: Azure Disk Encryption (ADE) partition layout

When you apply Azure Disk Encryption (ADE) to a VM that you created from a custom image, it might place a System Reserved partition after the OS volume. This placement blocks the OS volume from extending into unallocated space. For detailed steps to resolve this specific scenario, see Can't extend an encrypted OS volume in Windows.

Cause 5: Insufficient RBAC permissions

If the Save button is greyed out in the Azure portal when you try to resize a disk, your account might not have the required role-based access control (RBAC) permissions on the disk resource.

Resolution

Step 1: Check the NTFS allocation unit size

Run the following command in an elevated Command Prompt to check the allocation unit size:

fsutil fsinfo ntfsinfo C:

In the output, find the Bytes Per Cluster value. Compare it to the table in Cause 1 to determine the maximum volume size for your configuration.

If the current allocation unit size limits the volume to a size smaller than what you need, move the data to a new volume that's formatted with a larger allocation unit size:

  1. Create a new data disk with the target size.

    In the Azure portal, go to the VM, select Disks > Create and attach a new disk, specify the size, and select Apply.


  1. Format the new disk with a larger allocation unit size. During the New Simple Volume Wizard, select a larger allocation unit size (for example, 64 KB for volumes up to 256 TB).

  2. Copy the data from the old volume to the new volume by using robocopy:

    robocopy D:\ E:\ /mir /z /w:5 /r:2 /mt
    
  3. Detach and delete the old data disk.

Important

You can't change the allocation unit size of an existing volume without reformatting it.

Step 2: Remove a blocking recovery partition

Note

Perform this resolution inside the VM guest operating system by using DiskPart. Azure CLI and Azure PowerShell aren't applicable for this step.

Important

Before you proceed, take a snapshot of the OS disk as a backup. If anything goes wrong, you can restore the VM from the snapshot.

Azure VMs don't use the Windows Recovery Environment (WinRE) because there's no console access. You can safely remove the recovery partition to free up adjacent space for extending the OS volume.

  1. Open an elevated Command Prompt.

  2. Start DiskPart:

    diskpart
    
  3. List and select the disk:

    list disk
    select disk 0
    
  4. List the partitions and identify the recovery partition:

    list partition
    
  5. Select the recovery partition (for example, Partition 4):

    select partition 4
    
  6. Delete the recovery partition:

    delete partition override
    
  7. In Disk Management, right-click the OS volume and select Extend Volume.

Step 3: Convert MBR to GPT for disks larger than 2 TB

Note

Perform this resolution step inside the VM guest operating system. Azure CLI and Azure PowerShell aren't applicable for this step.

If the disk uses the MBR partition style and you need a partition larger than 2 TB:

  • For the OS disk, use MBR2GPT.exe to convert without data loss:

    MBR2GPT /convert /allowFullOS
    

    Note

    MBR2GPT.exe works only for system (OS) disks. It isn't available on Windows Server 2016. You must upgrade to Windows Server 2019 or later before you convert. It's recommended to extend the OS volume before you convert, because extending the OS volume after conversion isn't supported.

    For detailed steps, see Update the guest OS volume from MBR to GPT.

  • For data disks, back up the data, delete the existing MBR partition, re-create the disk as GPT, and restore the data. For Linux VMs, see Failed to resize MBR partition for a data disk larger than 2 TB.

    Warning

    For SQL Server data drives, create a new GPT drive and migrate or copy the data to it. Converting an existing drive carries increased risk for SQL workloads.

Step 4: Check RBAC permissions on the disk resource

If the Save button is disabled in the Azure portal when you try to resize a disk, verify that your account has the required permissions:

  1. In the Azure portal, go to the disk resource.
  2. Select Access control (IAM).
  3. Verify that your account has the Contributor or Disk Operator role (or a custom role that includes Microsoft.Compute/disks/write).

If you don't have the required permissions, ask your subscription administrator to assign the appropriate role.

If none of the preceding steps resolve the issue, contact Azure Support.

References