How to increase C: on an Azure Virtual Machine

Category

Tutorials

Published

November 23, 2015

Sometimes there is a need to increase C: volume. The supported maximum size for a disk in Azure is at the moment of writing 1TB. Although there are no commands or selections in the portal for expanding disks for servers created under the Resource Manager. This guide explains how to expand an existing Windows OS disk (default size 127GB) under a virtual machine which is created under Resource Manager (ARM).

Thanks to Karl for giving me the correct parameters to set the disk size! You can find his excellent work here.

DISCLAIMER. These operations are not officially supported by Microsoft and the steps although should work are done on own risk. Also the steps are tested and verified  on Windows 2003R2 and 2012R2.

1.  Gather information

Create the server if not yet created through your favorite process. When it’s up and running, log in to the portal and write down the following:

  • Name of the VM
  • Name of the Resource Group
  • Name of the Subscription

2. Install latest PowerShell Azure module

If not yet installed, get the latest PowerShell Azure-module from here and install it.

3. Increase OS VHD

From the client you installed the PowerShell Azure module from, start PowerShell ISE.

Copy the following code:

Paste that in to the script window and change the variables to match the correct VM, resource group and subscription name as written down earlier.

Increase C: Azure

Press the “Play” button and log in with your credentials. If you get unrecognized account, it could be that you have not marked “log in with Microsoft account”)

The script shuts down the VM, set the parameters and starts it up.

You should get “Success” on the output in the command window.

4. Verify virtual disk size

When the above script is complete, log in to the VM.

You should see and similar output as below with the virtual disk having the size of 1023GB but C: volume still the same size.

Increase C: Azure

5. Increase C: volume

We will use a third party tool to increase the volume for reasons explained later. Download the software to the VM here and install it.

Start the AOMEI partition program. It should look something like this:

Increase C: Azure

We need to move the system volume (the volume which is 350MB in this example) to the end of the virtual disk since you need the free space for C: to be in direct conjunction with it.Mark the system volume, right click it and select “move partition”

Drag the slider to the furthest right as possible as below:

Increase C: Azure

Click “OK”.You should now have one pending operation in the left column.

Click “Apply” in the top left corner and then “Proceed”.

After the operation completed successfully it should look like this:

Increase C: Azure

Mark C: and right click, select “Resize partition”

Move the slider to the furthest right so the maximum size available is selected:

Increase C: Azure

Click “OK”.

You should now have one pending operation and the “Disk 1” should look like below:

Increase C: Azure

Click “Apply” in the top left corner and then “Proceed”.

The server needs to be rebooted so click “Yes”.

The server reboots.

Once the server is up and running, log in and verify the C: is the new size.It should look like this:

Increase C: Azure

Now you’re done!

Feel free to uninstall the AOMEI partition software.

As said earlier, tested on Windows 2012R2 created under ARM. But could work for other Windows versions and probably Linux for the first PowerShell-part.

Written by

Risto Lavett