(LVM) Extending a disk in CentOS



Once the physical space has been added (either as a new drive or extending the drive in a cloud control panel) you will need to follow these steps to complete adding the space to your filesystem.


1) Create new partition (set as type 8e) with the extra space at the end of the filesystem using fdisk.


a.) Run the command:
     # fdisk /dev/sda

b.) Press p to print the partition table to identify the number of partitions. By default, there are 2: sda1 and sda2.

c.) Press n to create a new primary partition.

d.) Press p for primary.

e.) Press 3 for the partition number, depending on the output of the partition table print.

f.) Press Enter two times.

g.) Press t to change the system's partition ID.

h.) Press 3 to select the newly creation partition.

i.) Type 8e to change the Hex Code of the partition for Linux LVM.

j.) Press w to write the changes to the partition table.


2.) After the partition is created, run "partprobe". If it gives an error, the VM will need to be rebooted before it will be able to use the extra space. Once this is done, verify the new partition with fdisk -l. It will likely be /dev/sda3.


3.) Create the volume: pvcreate /dev/sda3

4.) Extend the volume group: vgextend cl /dev/sda3


5.) Extend the logical volume: lvextend -l +100%FREE /dev/cl/root

  • Depending on the amount of space you want to add, change the 100% value to match.
  • To determine which volume group to extend, use the commandvgdisplay


6.) Extend the root filesystem: xfs_growfs /dev/cl/root

7.) Run "df -h | grep root" to confirm the filesystem grew to the expended size

Was this article helpful?
1 out of 1 found this helpful

Have more questions? Contact our support instantly via Live Chat