Usually when provisioning VM, on azure spefically, or even on aws, default partition like on the root or / partition is very minimal. We have here a 2GB / partition that we need to increase.
Steps:
1. Stop or deallocate the VM
2. Go to Disk, then OS DIsk and change the value, usually its 30 GB devided by other partition, so if you need to make it 40GB, just add 38, so make the number 68
3. Save and start the VM
4. Login as root via ssh
5. vgdisplay. sample below.
[root@valog02 ~]# vgdisplay
--- Volume group ---
VG Name rootvg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 7
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 6
Open LV 6
Max PV 0
Cur PV 1
Act PV 1
VG Size <63.02 GiB
PE Size 4.00 MiB
Total PE 16132
Alloc PE / Size 6400 / 25.00 GiB
Free PE / Size 9732 / <38.02 GiB
VG UUID WhcyfU-IClc-LyI5-uSec-5aAL-lyBp-Orfbf0
Notice the #Free PE / Size 9732 / <38.02 GiB#, so we have some 38GB free to use.
Current size is:
/dev/mapper/rootvg-rootlv 2.0G 66M 2.0G 4% /
6. Now, extend it using lvextend. The LV part is "/dev/mapper/rootvg-rootlv", so command would be below. I just made it 37GB instead, so outcome would be 39GB.
lvextend -L +37G /dev/rootvg/rootlv
Sample:
[root@valog02 ~]# lvextend -L +37G /dev/rootvg/rootlv
Size of logical volume rootvg/rootlv changed from 2.00 GiB (512 extents) to 39.00 GiB (9984 extents).
Logical volume rootvg/rootlv successfully resized.
7. Now that we have extended it, we will grow it online.
xfs_growfs /dev/rootvg/rootlv
[root@valog02 ~]# xfs_growfs /dev/rootvg/rootlv
meta-data=/dev/mapper/rootvg-rootlv isize=512 agcount=4, agsize=131072 blks
= sectsz=4096 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=524288, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2560, version=2
= sectsz=4096 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 524288 to 10223616
8. Check the size now.
[root@valog02 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 16G 0 16G 0% /dev
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 16G 34M 16G 1% /run
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/mapper/rootvg-rootlv 39G 70M 39G 1% /
9. Try to reboot if none production yet.
That's all, keep safe everyone.
Adding this from azure site.
https://docs.microsoft.com/en-us/azure/virtual-machines/linux/resize-os-disk-gpt-partition