Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Are you running out of space on the OS or data disk of your Azure VM? Here is a simple way to resize the OS or the data disk. Resizing of the disk is done using Azure PowerShell. If you don’t have Azure PowerShell on your local machine, then you can follow the documentation to install Azure PowerShell in your local machine and connect to your Azure Subscription.
Note: I have tested this for VM's running Windows OS only but not Linux. Also keep in mind that once you run the command to resize the disk it is irreversible. You will NOT be able to shrink the disk. In addition, this applies only to V1 VM's created using Azure Service Manager (ASM). If you like to resize disks for Azure Resource Manager (ARM), see my blog @ Resize Azure Resource Manager (ARM) VM OS & Data disk using Azure Portal
Few things to ensure before performing shutdown/de-allocation of the VM:
Resizing OS disk:
On the classic portal: On the new portal:
Get-AzureVM -ServiceName "<Cloud Service Name>" -Name "<VM Name>" | Get-AzureOSDisk
For example:
Get-AzureVM -ServiceName MnDemoVM2 -Name "MnDemoVM2" | Get-AzureOSDisk
VHDs Path:
Before Resize:
Update-AzureDisk -DiskName "<OS Disk Name>" -Label Resized -ResizedSizeInGB 400
Note: Azure allows you to have a OS or Data disk up to 1TB (1023 GB) for each disk.
For example:
Update-AzureDisk -DiskName "MNDemoVM2-MNDemoVM2-0-201510092258210053" -Label Resized -ResizedSizeInGB 400
After Extending the volume:
*********************************************************************************************************************************************************************
Resizing Data disk:
Get-AzureVM -ServiceName "<Cloud Service Name>" -Name "<VM Name>" | Get-AzureDataDisk
For example:
Get-AzureVM -ServiceName MnDemoVM2 -Name "MnDemoVM2" | Get-AzureDataDisk
Before Resize:
Update-AzureDisk -DiskName "<Data Disk Name>" -Label ResizeDataDisk -ResizedSizeInGB 500
Note: Azure allows you to have a OS or Data disk up to 1TB (1023 GB) for each disk.
For example:
Update-AzureDisk -DiskName MNDemoVM2-MNDemoVM2-0-201511032306210081 -Label ResizeDataDisk -ResizedSizeInGB 500
I hope this post helped you resolve your OS or Data disk resizing issue. Please feel free to comment if you have any additional questions.
DISCLAIMER: The above blog posting is provided "AS IS" with no warranties and confers no rights.
Anonymous
December 21, 2015
Can this be done with a resource manager VM? I don't see any Get-AzureRMOSDisk cmdlets or anything like that avaiable.
Anonymous
February 01, 2016
Hi Nicolai, there is no option to resize OS or data disk for VM's created using ARM yet.
Anonymous
February 04, 2016
To resize an ARM vm OS disk with powershell (commandlet options not visible), not sure if it's supported but it works on windows RM VMs. It's very difficult working with the half baked IaaS V2 products.
Also note the the azure windows server 2012R2 image from teh market place places the system reserved partition after the OS install - so even after you extenrd the disk, you can't extened C: due to the non contiguous free space. This is more painful than it should be at every turn - so we're likely going to look elsewhere for our cloud platform.
#note this powers down and deallocates the VM as it can't be done live
Login-AzureRmAccount
$VMname = "VMnameHere"
$rsg = "resourcegroupnameHere"
$VM = Get-AzureRmVM -Name $VMname -ResourceGroupName $rsg
Stop-AzureRmVM -Name $vmname -ResourceGroupName $rsg -Force
$vm.StorageProfile.OsDisk.DiskSizeGB = 200 Update-AzureRmVM -VM $VM -ResourceGroupName $rsg #to resize data disk also Set-AzureRmVMDataDisk -Name diskname.vhd -DiskSizeInGB 1023 -Caching None -VM $VM Update-AzureRmVM -VM $VM -ResourceGroupName $rsg
* **Anonymous**
September 23, 2016
Azure RM supports for resize of data disk. If yes share us the REST API details for the same.
* **Anonymous**
September 27, 2016
Vijay, For ARM VM's, you can resize OS/data disk within the new portal. Quickly blogged about it here, https://blogs.msdn.microsoft.com/madan/2016/09/28/resize-azure-resource-manager-arm-vm-os-data-disk-using-azure-portal/
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in