Expand Disk Space - Virtual Machine

These are the step I used on my EC2 instance on AWS with it live:

fdisk /dev/xvda
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): p

Disk /dev/xvdf: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000ca471

Device Boot      Start         End      Blocks   Id  System

/dev/xvda1 * 2048 4098047 2048000 83 Linux
/dev/xvda2 4098048 20971519 8436736 8e Linux LVM

Command (m for help): d
Partition number (1,2, default 2): 2
Partition 2 is deleted

Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (2-4, default 2): 2
First sector (4098048-209715199, default 4098048):
Using default value 4098048
Last sector, +sectors or +size{K,M,G} (4098048-209715199, default 209715199):
Using default value 209715199
Partition 2 of type Linux and of size 98 GiB is set

Command (m for help): t
Partition number (1,2, default 2): 2
Hex code (type L to list all codes): 8e
Changed type of partition ‘Linux’ to ‘Linux LVM’

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

partprobe

pvdisplay --maps
— Physical volume —
PV Name /dev/xvda2
VG Name SangomaVG
PV Size <8.05 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 2059
Free PE 91
Allocated PE 1968
PV UUID 1LmtJa-KYIp-RQqe-90JF-eysD-4HQx-Mg0x2N

— Physical Segments —
Physical extent 0 to 1711:
Logical volume /dev/SangomaVG/root
Logical extents 0 to 1711
Physical extent 1712 to 1967:
Logical volume /dev/SangomaVG/swaplv1
Logical extents 0 to 255
Physical extent 1968 to 2058:
FREE

pvresize /dev/xvdf2
Physical volume “/dev/xvda2” changed
1 physical volume(s) resized / 0 physical volume(s) not resized

pvdisplay --maps
— Physical volume —
PV Name /dev/xvda2
VG Name SangomaVG
PV Size 98.04 GiB / not usable 2.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 25099
Free PE 23131
Allocated PE 1968
PV UUID 1LmtJa-KYIp-RQqe-90JF-eysD-4HQx-Mg0x2N

— Physical Segments —
Physical extent 0 to 1711:
Logical volume /dev/SangomaVG/root
Logical extents 0 to 1711
Physical extent 1712 to 1967:
Logical volume /dev/SangomaVG/swaplv1
Logical extents 0 to 255
Physical extent 1968 to 25098:
FREE

You will need the Physical extent start and ending for the swap
to get the starting block take the ending block from Physical extent of the free space and subtract 255

pvmove --alloc anywhere /dev/xvda2:1721-1967 /dev/xvda2:24843-25098
/dev/xvdf2: Moved: 0.00%
/dev/xvdf2: Moved: 97.17%
/dev/xvdf2: Moved: 100.00%

vgdisplay
— Volume group —
VG Name SangomaVG
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 7
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 98.04 GiB
PE Size 4.00 MiB
Total PE 25099
Alloc PE / Size 1968 / <7.69 GiB
Free PE / Size 23131 / <90.36 GiB
VG UUID HPP92b-Wzg7-zBe4-AC4q-ZXxg-DB3u-NldSTv

lvextend -L 90.36G /dev/SangomaVG/root
Rounding size to boundary between physical extents: 90.36 GiB.
Size of logical volume SangomaVG/root changed from <6.69 GiB (1712 extents) to 90.36 GiB (23133 extents).
Logical volume SangomaVG/root successfully resized.

xfs_growfs /dev/SangomaVG/root
meta-data=/dev/mapper/SangomaVG-root isize=512 agcount=4, agsize=438272 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=1753088, 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=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 1753088 to 23688192