Official support for CentOS 7 ended on 30 June 2024; security updates are no longer released. For new installations choose a supported distribution such as AlmaLinux or Rocky Linux. The steps below apply to existing CentOS 7 servers.
This guide shows how to add newly allocated disk space to the root partition on a CentOS 7 server that uses LVM. Run the following commands in order:
parted /dev/sda --script mkpart primary $(parted /dev/sda print | grep lvm | awk '{print $3}') 100%
pvcreate /dev/sda3
vgextend cl /dev/sda3
lvextend /dev/cl/root /dev/sda3
xfs_growfs /dev/cl/root
The commands assume the disk is /dev/sda, the new partition is /dev/sda3 and the volume group is named cl. Check your own names with lsblk and vgs before running them, and take a backup first.
Can't find the information you are looking for?