Expanding an Rocky 8 VMware Virtual Disk

This is always something I forget. How do you expand the filesystem after you expand an existing virtual disk on Rocky Linux 8?

  1. Install growpart using dnf install -y cloud-utils-growpart
  2. Find the partition you need to expand using fdisk -l. In my example, it was /dev/sda3 image
  3. Grow the partition using growpart /dev/sda 3 Here you specify the partition number of the device, so the space is required.
  4. Find the path of the lvm logical volume using lvdisplay image
  5. Extend the logical volume using lvextend -l +100%FREE <LGPATH>
  6. Extend the filesystem using xfs_growfs <LGPATH>
  7. DONE!
Written on February 3, 2024