Microsoft Azure allows for deploying a variety of stock Linux Images from the virtual machine gallery. There is a wide selection to choose from but you will notice that the OS disk that is created when using these templates may not be sufficient for your needs. Here is how you can resize the OS Disk for your Linux VM in the new Azure Portal.
If you feel lost following the screenshot from within the Azure portal, you can follow the breadcrumb path at the top of the picture to ensure you are in the right pane 🙂
Ingredients:
CloudXplorer from ClumsyLeaf Software (trial edition works)
Steps:
- Select a Linux VM Image to Deploy
2. Deploy Linux based VM in Microsoft Azure
3. Create DNS to simplify remote access (optional)
4. Remote into VM over SSH and run df -h to view disk size and utilization of deployed VM
Note: OS disk/dev/sda1 is currently 27G
5. Stop the Deployed VM (this will allow us to break the lease the VM has on the vhd containing the OS disk)
6. Locate storage account for your VM and note the Blob properties indicate the VHD holding the OS disk is currently leased
7. Find the credentials for your storage account
8. Open Cloud Explorer and add a new Azure Blobs account
9. Apply credentials from Step 7
10. Right-click on the VHD containing the OS Disk
11. Break the lease to allow modification
12. Right-Click again to expand the Virtual Disk to the desired size
13. Note that the Blob Properties now reflect the new size
14. Restart the VM
15. After successfully starting, the Blob Properties should now reflect a new lease with status of “Locked”
16. Remote into VM again and check size.
Depending on the image you may need to run:
sudo resize2fs /dev/sda1
Newer kernels automatically resize to available disk. This was the case with Ubuntu 16.04.
Note that /dev/sda1 is now 77G
Happy Hacking!