How to Resize Azure VM Disk?

Is your Azure VM running out of disk space? The default OS disk size varies depending on the VM you deploy. For some, a 128GB OS disk is enough. But with constant updates and package/software installation, the free space can shrink uncontrollably.

The good news is that you can conveniently resize Azure VM disks in a few ways. Whether you favor the GUI or command line, you can perform any Azure VM resize disk operation and achieve the same result. This applies to both OS and data disks in Windows or Linux VMs.

How to Resize Azure VM Disk using the Portal

First, let’s look at resizing an Azure VM disk using the Azure Portal. In this example, we’re increasing the OS disk size on a Windows VM named windowsDemo.

  1. Log in to the Microsoft Azure Portal.
  2. Open the Azure VM where the disk to resize is attached and ensure its status is Stopped. If not, stop the VM first.
    resize azure vm disk
  3. Next, click Disks. As you can see below, two disks are attached to the VM; one OS disk and one data disk. In this example, we’re resizing the OS disk.
    azure increase disk size
  4. Next, click on the Size + performance blade. You can choose the disk SKU and the new disk size on this blade.
    Let’s choose 256GB as the new OS disk size in this example, but we will not change the SKU and leave it as is. Click Resize to resize the disk.
    azure resize disk
  5. Wait for the Azure VM resize disk operation to complete, and you should see a confirmation message, as shown below.
    azure vm increase disk size
  6. At this point, you can now start the Azure VM again and log in to the operating system.

Extend the Volume Inside the Windows VM

Once you log in to the VM, you’ll notice that the volume size hasn’t changed, although you’ve already performed the Azure resize OS disk process. That’s because you only increased the virtual hard disk size (256GB), but the logical volume partition remains the same (127GB).


azure resize os disk

Let’s now expand the volume to occupy the new free space.

  1. First, open the Disk Management console. Right click the Start button and click Disk Management.
    azure vm resize diskYou’ll see that the OS disk now has unallocated space.
    azure extend disk size
  2. Next, right-click on the system partition and click Extend volume.
    azure disk resize
  3. Click Next on the Welcome page.
  4. The Wizard automatically populates the maximum available disk space. Keep the maximum value and click Next.
    resize disk azure
  5. Click Finish on the Wizard. The OS volume has now increased to 256GB, as intended.
    azure increase disk size linux

How to Resize Azure VM Disk using PowerShell

This time let’s perform an Azure increase disk size operation using PowerShell. You can perform this method on your local computer using the Azure PowerShell module or the Azure Cloud Shell.

In this example, we’ll resize the data disk on a Linux VM called ubuntuDemo.

  1. If you’re using the Azure PowerShell module locally, log in to Azure by running the following command:
  2. Next, make sure to select the correct Azure subscription so that you can access the right resources:
  3. Next, define the VM name and resource group where it resides:
    $vmName = 'ubuntuDemo' 
    $resourceGroupName = 'DEV'
  4. Stop the Azure VM if it is currently running:
    Stop-AzVM -ResourceGroupName $resourceGroupName -Name $vmName

    azure expand disk

  5. Retrieve the Azure VM object and store it in the $azVM variable:
    $azVM = Get-AzVM -Name $vmName -ResourceGroupName $resourceGroupName
  6. Next, get the name of the data disk you want to resize and its resource properties:
    # Display the data disk name 
    # Get the disk details 
    $disk = Get-AzDisk -ResourceGroupName $resourceGroupName -Name 'disk name here'

    increase azure vm disk size

  7. Now, let’s increase the disk size to 64GB:
    # Increase the disk size value 
    $disk.DiskSizeGB = 64 
    # Update the data disk with the disk 
    Update-AzDisk -ResourceGroupName $resourceGroupName -Disk $disk -DiskName $disk.Name

    Now you should see the result says that the DiskSizeGB is not 64 (GB).
    increase disk size azure

  8. Finally, start the VM:
    Start-AzVM -ResourceGroupName $resourceGroupName -Name $vmName

    expand azure vm disk

Extend the Partition and Filesystem Inside the Linux VM

You’ve successfully resized the Azure disk, but your job is half done. You still need to resize the partition and file system inside the Linux VM.

  1. Log in to the Linux Azure VM:
    ssh devadmin@ubuntuDemo
  2. Next, list the partitions and look for the one to resize:
    df -Th

    In this case, the data disk partition is /dev/sdc1 mounted on /datadisk.
    increase disk size in azure vm

  3. Unmount the partition before making any changes:
    sudo umount /dev/sdc1
  4. Enter the parted utility and select the /dev/sdc disk:
    sudo parted /dev/sdc
  5. Run the print command to display the disk information and partition layout. As you can see below, the underlying disk size is 68.7GB, but the existing partition size is only 34.4GB. Note the partition number.
    azure vm expand disk
  6. Resize the partition by running the resizepart command. To break down the command: 1 is the partition number, 68.75GB is the maximum disk size:
    resizepart 1 68.75GB
    As you can see, the partition size is now 68.7GB.
    azure resize disk linux
  7. Next, resize the filesystem using the resize2fs command:
    sudo resize2fs /dev/sdc1

    azure vm disk resize

  8. After resizing the disk and partition, you can now re-mount the partition:
    sudo mount /dev/sdc1 /datadisk
  9. Finally, confirm the partition is mounted and that the size is updated:
    df -Th

    azure resize vm disk


Congratulations! You’ve just performed the Azure VM resize disk methods — using the Portal and PowerShell. You also completed resizing volumes, partitions, and filesystems inside the Windows ad Linux VM operating systems.

I enjoy technology and developing websites. Since 2012 I'm running a few of my own websites, and share useful content on gadgets, PC administration and website promotion.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.