This guide will quickly cover the limitations in Azure OS Disks and cover how to resize a Linux Virtual Machine in Azure using the Azure CLI. We just received a question this morning requesting some further explanation as to how our prep courses for Azure here at Linux Academy state that the limitation for Azure OS disks are 127 GB even though the limitation was increased to 1023 GB. This on the surface may seem quite confusing however there are some interesting details that will shed some further light on the matter. We decided to write a very quick guide to point things in the right direction.
Azure OS Disk Limitations
OS Disk limitations in Azure are specifically setup and recommended not to be used for performance intensive production loads. Disk caching in Azure is tuned towards OS performance thus applications with persistent data requirements achieve better throughput utilizing an attached Data Disk. Now originally, OS disk limitations for size were set at a hard limit of 127 GB. As of 2015, this limitation was lifted to 1023 GB however there are some points to keep in mind. All Azure marketplace/gallery VMs will for the foreseeable future still load and launch with a 127 GB OS Disk.
So what does the 1023 GB Change mean?
This is actually utilized for two main reasons, one that the original 127 GB OS limitation was removed or changed in the manner that it is no longer enforced at the time of Import of a VM. Primarily this was to assist in the migration of on-premise VMs to the Azure Platform. By adjusting the limitation to octuple the original amount, Azure’s primary reason for this change was to exponentially strengthened its on-premise migration and Disaster Recovery offerings. The second reason is that since the limitation is no longer enforced but we are still given 127 GB OS images from the marketplace, we are now able to resize those images. Note also that the typical OS Disk size for Linux VMs in Azure is 30 GB.
Increase the size of linux os Disks using the azure cli
1.) Ensure you have the latest Azure CLI Installed and you are able to log into your Azure Resource Manager account using the follow code
azure config mode arm
2.) We must first stop the VM and removed it from production or “running” state in order to perform virtual hard disk operations
azure vm deallocate --resource-group "NAME OF MY RESOURCE GROUP" --name "NAME OF LINUX MACHINE"
3.) Now we will update the unmanaged OS Disk to a 75GB disk size:
azure vm set --resource-group "NAME OF MY RESOURCE GROUP" --name "NAME OF LINUX MACHINE" --new-os-disk-size 75
4.) Lets start the VM now:
azure vm start --resource-group "NAME OF MY RESOURCE GROUP" --name "NAME OF LINUX MACHINE"
5.) After connecting to the virtual machine, use your Linux OS specific utility to lookup the disk size to confirm all changes were implemented successfully.
Though there is a limitation removal and increase from 127 GB to 1023 GB for OS Disks in Azure, we will still receive a default 127 GB OS Disk image and a 30 GB Linux OS disk image when utilizing a virtual machines from the Azure gallery/marketplace. With the instructions above and some clarifications we hope this will point you in the right direction for those unique scenarios where you may have to travel outside of best practice and increase the size of the OS Disk.