Eli Weinstock-Herman

Expanding an Existing Azure VM System Drive

Original post posted on April 18, 2014 at LessThanDot.com

I have an Azure VM that was created back when the C: drives had an 30GB size limitation (which leaves maybe 8GB after all the OS files, Windows updates, etc). This present a considerable challenge when I go to install something that has to be installed on the C: Drive, like Visual Studio 2013.

Finding a path from a 30GB primary drive to (anything larger) was a little rough, most of the information I found said you had delete the VM, download the drive, attach it to another VM as a secondary drive, extend it, then re-upload it and do some extra magic to make it usable as a primary drive again and then re-create the VM. Doing all of this from another VM inside Azure looked like it would speed things up a bit, but it was still a pretty painful process.

While I was trying the longer process though, I found a series of smaller tools that people had used to make individual steps easier. I was able to piece all of those together into a process that allowed me to extend the primary drive in place in less time than it took to delete and download the drive to another VM.

The Quicker Process

So, with a big fat “this worked on my machine and might blow up yours” disclaimer, here’s that process:

  1. Stop the server
  2. Delete the server (but keep the drives)
    • Azure Dashboard – Virtual Machines
    • Select the Server
    • Press Delete
    • Select Delete but keep the drives option
  3. Backup the drive
  4. Delete the disk
    • Azure Dashboard – Virtual Machines
    • Select Disks at top
    • Select the drive + press Delete
    • Select the “Delete and retain associated VHD” option
  5. Resize the Disk
    • Download WindowsAzureDiskResizer:
    • Use the WindowsAzureDiskResizer with a command like:
      E:\Downloads\WindowsAzureDiskResizer->WindowsAzureDiskResizer.exe 120 "<URL for blob here>"

      Output will look like:

      		WindowsAzureDiskResizer v1.0.0.0
      		Copyright 2013 Maarten Balliauw
      		[4:20 PM] Determining blob size...
      		[4:20 PM] Reading VHD file format footer...
      		[4:20 PM] VHD file format fixed, current size 32212254720 bytes.
      		[4:20 PM] Expanding containing blob...
      		[4:20 PM] Updating VHD file format footer...
      		[4:20 PM] New VHD file size 128849018880 bytes, checksum 4294960647.
      		[4:20 PM] Writing VHD file format footer...
      		[4:20 PM] Overwriting the old VHD file footer with zeroes...
      		[4:20 PM] Done!
  6. Re-Create the Disk
    • Azure Dashboard – Virtual Machines – Disks
    • Select “Create” at the bottom
    • Name the drive
    • Select the VHD you just resized
    • Check the “this contains an OS” box and select “Windows”
  7. Re-create the VM
    • Azure Dashboard
    • New – Compute – Virtual Machine – From Gallery
    • Select “My Disks”
    • Select the new drive you just re-created
    • Finish the wizard to setup the VM like it originally was
    • Attach any other drives it originally had (reboot?)
    • Configure ACL rules in the Endpoints of the Virtual Machine
    • RDP Connect to the server
    • you may need to use IP address at this point, my DNS wasn’t updating and I had used same name as original server
  8. Resize the disk
    • Open Server Manager
    • Select Storage, then Disk Management
    • Select the drive you resized
    • Right click and select “Expand”
    • Wizard!
  9. Hurrah, the disk is embiggened!

And there you go, all without multi-GB downloads, re-uploads, etc.

Comments are available on the original post at lessthandot.com