9 Easy Steps To Increase Your Root Volume Of AZURE Instance

Resize RHEL server OS disk in Azure:

Pre-Requisite:
1.Create an image of your VM disk.

Images –> Add –> Give Name, Storage blob URL, ResourceGroup, OS Type –> Create

2.Stop the VM

VM –> Overview –> Stop

For Ubuntu:

VM –> Disks –> click on OS Disk –>> Change the Size –>> Save

For Ubuntu this will take effect directly.

For RHEL follow the below steps.

Steps to increase the volume:
start your instance and run the following command as root user or root privileged user.

1) fdisk /dev/sda => Replace sda with your partition to change the size

2) Command (m for help): => Prompt will be like this

3) Type ‘p’ => Will show partitions like /dev/sda1 , /dev/sda2 etc…

4) Type ‘d’ then partition number to delete => If you are going to resize sda2 give ‘2’

5) Type ‘n’ then ‘p’, 2 (to recreate partition 2) you can accept the default values

6) Type ‘w’ => It will update partition table with new sector range

7) Type ‘q’ => To exit fdisk

8) sudo reboot => Reboot the VM to update the partition

9) sudo xfs_growfs /dev/sda2 => At last execute the below command to update the partition in file system
Note: For RHEL 6 version use, sudo resize2fs /dev/sda2

Using Azure-cli can resize the root disk of managed disk:
1) Login to azure cli
az login
2) Stop the VM
az vm deallocate –resource-group <ResourceGroup> –name <VMName>
3) Get the list of disks in the resource group of VM
az vm list –resource-group <ResourceGroup> –query “[*].{Name:name,DiskName:storageProfile.osDisk.name}” –output table
4) Update the disk size
az disk update –resource-group <ResourceGroup> –name <DiskName> –size-gb <NewSize>
5) Now check the updated disk size
az disk list –resource-group <ResourceGroup> –query “[?name == ‘<DiskName>’].{Name:name, DiskSize:diskSizeGb}” –output table
6) Start the VM
az vm start –resource-group <ResourceGroup> –name <VMName>
7) After resize have to follow the above common steps to reflect the updated size.

Leave a comment