Expand / Resize Windows Azure VM OS / Data Disk

Author by Steve Borgwardt

While working on a Microsoft Azure Virtual Machine (classic) recently, I noticed that the OS disk was almost out of disk space along with an additional data disk that was attached to this Windows VM.

If you are using a newer VM from Azure, you probably won’t encounter these problems as the default OS disk size is now 127GB and data disks default to 1023GB when creating a new one.

Unfortunately, the Azure portal doesn’t make it easy to resize your VM disks without some 3rd party tools or PowerShell commands versus a wizard in the web interface. After some research, I found some great articles including this one on MSDN forums that address this issue with expanding the OS drive.

If you have an older “classic” VM in Azure, you are aware that it came with a 30GB OS drive that will fill up quickly with just the OS and Windows Update files.

Below are the steps I put together that are simpler than other solutions I have found and only requires a free trial of the awesome tool CloudXplorer (I purchased a subscription) and accessing the old Azure portal to accomplish these tasks.

Note: Please be careful while following these steps to not delete the actual VHD file and I recommend doing a backup of the VM and VHD files first.

 

Resize Windows Azure VM Data Disk

  1. Navigate to the old Azure portal (https://manage.windowsazure.com) and go to the VM that you would like to expand the disk size on. On the dashboard page, click on the Disk you want to expand and then click the “Detach Disk” button. NOTE: Make note of the Disk name as you will need to remember this for step 2 to delete it.

  1. Next, we need to delete the disk from the VM – BUT keep the VHD Blob file.  (Note: We aren’t actually deleting the data on the disk, but just the disk container from the VM – and keeping the VHD file.)

Go back to the main Virtual Machines page and click on “Disks” at the top and then select the Disk you want to expand that we just detached in step 1.


 

Then click on the “Delete” button and select “Retain the associated VHD”

 

  1. Now open CloudXplorer and navigate to your storage account and container and find the disk you want to expand. Right-click on it and select Expand Drive. 
    1. OS: 127GB (Don’t exceed)
    2. DATA:  max is 1023 GB

  1. Return to the disk page on the Virtual Machines page and click on “Create”  This will create the new disk and select your VHD file that you just expanded.
  2. Click on your VM that this disk should belong to and on the dashboard page click on “Attach” -> “Attach Disk” and select your existing disk you created from step 4.

 

  1. RDP to your virtual machine and open disk management and extend your volume on the disk you just expanded.

     

 

Expand VM OS Disk

  1. Shut down VM from Azure
  2. Make note of VM OS VHD URL, OS Disk Name (on VM Disk tab) and exact name of VM
    1. NewDiskName (disk name)
      http://portalvhdsc1fx1122333.blob.core.windows.net/vhds/cimplecerts-cimplecerts-2012-09-01.vhd
    2. MyExactVMName  (vm name)
  3. Delete the VM, but keep the disk
    Note:
    By doing this you will lose your current public IP address and receive a new one after creating new VM, so any DNS records will have to be updated.
  4. Use CloudXplorer to connect to your Azure blob storage account and right-click on disk to expand disk and increase size to max of 127GB.
  5. Return to the disk page on the Virtual Machines page and click on “Create”  This will create the new disk and select your VHD file that you just expanded and check box for VHD contains an OS.
  6. Create new VM from gallery using “My Disks” section using old portal with EXACT same name and attach directly to disk (not image)
  7. RDP to new VM and open Disk Management and right-click on OS drive and select “Extend Volume…” to expand OS drive to new size.

 

Once that is complete you will have your disks on the Azure VM showing the new size with plenty of space.

Good Luck!

 

Author

Steve Borgwardt

Senior Application Developer

Tags in this Article