My CentOS vm was near the capacity of its allocated VHD. I used VHD Resizer from VMToolKit to expand the file container.
Once it is expanded, the inner layers must expanded as well. This is a collection of info I found on google.
Resizing the “main” volume
1. fdisk /dev/sda then press p
Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1188 9438187+ 8e Linux LVM
2. Press d then 2 to remove the partition
3. Press n then primary p start cylinder 14 last cylinder 4865 to add the newly re-sized partition. WARNING: Make sure the old and new partition start at the same cylinder position, not doing so will destroy your data.
4. Press t partition 2 Hex code 8e
5. Press p
Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 4865 38973690 8e Linux LVM
6. Finally press w write table to disk and exit and reboot
7. Use vgdisplay, pvdisplay, or lvdisplay to show the current and later ending size of your LV
8. Run pvresize /dev/sda2 to expand the PV on /dev/sda2 after enlarging the partition with fdisk
9. You could also extend the volume group across disks and partitions: pvcreate /dev/hdb1; vgextend videovg /dev/hdb1; vgdisplay videovg. With this method use fdisk to create a new partition instead of recreating the original one. This is certainly safer since there is less risk to your existing data and it makes it easier to break up volume groups in the future.
10. Use vgdisplay to find the Free PE / Size
--- Volume group ---
VG Name SystemVG
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 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 37.17 GB
PE Size 4.00 MB
Total PE 9515
Alloc PE / Size 2176 / 8.50 GB
Free PE / Size 7339 / 28.67 GB
VG UUID Bl4LEQ-R70i-3Qse-9z1p-BRcK-ibd7-2aelYx
11. Use lvdisplay to display current logical volumes
--- Logical volume ---
LV Name /dev/SystemVG/RootLV
VG Name SystemVG
LV UUID dxB6Fs-6sQr-AaLg-1zQ6-Q1f9-AN6V-cbSovF
LV Write Access read/write
LV Status available
# open 1
LV Size 8.00 GB
Current LE 2048
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:0
--- Logical volume ---
LV Name /dev/SystemVG/SwapLV
VG Name SystemVG
LV UUID vSRWGx-zy8N-FrXK-3HP5-7pwW-F6SQ-IRJNeA
LV Write Access read/write
LV Status available
# open 2
LV Size 512.00 MB
Current LE 128
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:1
12. lvextend -l +7339 /dev/SystemVG/RootLV (you can use the following to reduce again lvreduce -l -7339 /dev/SystemVG/RootLV)
13. lvdisplay /dev/SystemVG/RootLV to see the result
--- Logical volume ---
LV Name /dev/SystemVG/RootLV
VG Name SystemVG
LV UUID dxB6Fs-6sQr-AaLg-1zQ6-Q1f9-AN6V-cbSovF
LV Write Access read/write
LV Status available
# open 1
LV Size 36.67 GB
Current LE 9387
Segments 2
Allocation inherit
Read ahead sectors 0
Block device 253:0
14. ext2online /dev/SystemVG/RootLV while the filesystem is mounted or to be safe use resize2fs /dev/SystemVG/RootLV while the filesystem is unmounted.
http://www.linuxquestions.org/questions/fedora-35/lvm-partition-resizing-666683/
Resizing the swap
Look for the swap logical volume.
cat /etc/fstab | grep swap
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
Check current size with lvdisplay.
lvdisplay /dev/VolGroup00/LogVol01
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID RVIFz3-B8kp-z9KV-JYtG-N997-JOQ6-ETaJaJ
LV Write Access read/write
LV Status available
# open 1
LV Size 512.00 MB
Current LE 24
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:1
Unmount the swap with swapoff.
swapoff /dev/VolGroup00/LogVol01
Resize and mount swap.
lvresize /dev/VolGroup00/LogVol01 -L 768M
Extending logical volume LogVol01 to 768.00 MB
Logical volume LogVol01 successfully resized
mkswap /dev/VolGroup00/LogVol01
swapon /dev/VolGroup00/LogVol01
free -m
total used free shared buffers cached
Mem: 375 343 32 0 48 120
-/+ buffers/cache: 174 201
Swap: 767 0 767
http://ukstokes.com/blog/2008/08/12/resize-swap-partitions-on-red-hat-linux/