Azure: How to expand virual hard disks on a Linux VM

Forget it a few times 🙃
 
Mark it here for reference
 
 
Original [1]:

[root@rhel-raw ~]# yum install cloud-utils-growpart gdisk
 
[root@rhel-raw ~]# lsblk -f
NAME    FSTYPE LABEL UUID                                 MOUNTPOINT
sda
├─sda1  xfs          2a7bb59d-6a71-4841-a3c6-cba23413a5d2 /boot
├─sda2 xfs         148be922-e3ec-43b5-8705-69786b522b05 /
├─sda14
└─sda15 vfat         788D-DC65                            /boot/efi
sdb
└─sdb1  ext4         923f51ff-acbd-4b91-b01b-c56140920098 /mnt/resource
 
[root@rhel-raw ~]# gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 100663296 sectors, 48.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 78CDF84D-9C8E-4B9F-8978-8C496A1BEC83
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 62914526
Partitions will be aligned on 2048-sector boundaries
Total free space is 6076 sectors (3.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
1         1026048         2050047   500.0 MiB   0700
        2050048        62912511   29.0 GiB    0700
14            2048           10239   4.0 MiB     EF02
15           10240         1024000   495.0 MiB   EF00  EFI System Partition

[root@rhel-raw ~]# growpart /dev/sda 2
CHANGED: partition=2 start=2050048 old: size=60862464 end=62912512 new: size=98613214 end=100663262
 
[root@rhel-raw ~]# gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 100663296 sectors, 48.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 78CDF84D-9C8E-4B9F-8978-8C496A1BEC83
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 100663262
Partitions will be aligned on 2048-sector boundaries
Total free space is 4062 sectors (2.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1         1026048         2050047   500.0 MiB   0700
   2         2050048       100663261   47.0 GiB    0700
14            2048           10239   4.0 MiB     EF02
15           10240         1024000   495.0 MiB   EF00  EFI System Partition
 
[root@rhel-raw ~]# xfs_growfs /
meta-data=/dev/sda2              isize=512      agcount=4, agsize=1901952 blks
                =                             sectsz=4096  attr=2, projid32bit=1
                =                             crc=1            finobt=0 spinodes=0
data         =                             bsize=4096   blocks=7607808, imaxpct=25
                =                             sunit=0         swidth=0 blks
naming    =version 2              bsize=4096   ascii-ci=0 ftype=1
log           =internal                bsize=4096   blocks=3714, version=2
                =                            sectsz=4096  sunit=1 blks, lazy-count=1
realtime  =none                     extsz=4096   blocks=0, rtextents=0
data blocks changed from 7607808 to 12326651

 
 
 
References
[1] Expand virtual hard disks on a Linux VM


Update