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
- 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.
- 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”
- 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.
- OS: 127GB (Don’t exceed)
- DATA: max is 1023 GB
- 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.
- 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.
- RDP to your virtual machine and open disk management and extend your volume on the disk you just expanded.
Expand VM OS Disk
- Shut down VM from Azure
- Make note of VM OS VHD URL, OS Disk Name (on VM Disk tab) and exact name of VM
- NewDiskName (disk name)
- MyExactVMName (vm name)
- 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.
- 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.
- 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.
- Create new VM from gallery using “My Disks” section using old portal with EXACT same name and attach directly to disk (not image)
- 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.