How To increase / Expand /Resize Disk Space On CentOS VM


First you need to add additional disk space on the host server to the Linux machine, next you can reboot in order to let the operating system recognize the disk size change, to that without reboot you can run :

find /sys -iname 'scan'   
echo "- - -" >/"the right device you got in the find
fdisk -l (to see the changes)
df -h  (another way)
or pvdisplay and lvdisplay to see all the partition size

Then you want to use parted, if you do not have just install it :

yum -y install parted

Run Parted To start the program :


Type print to get the partition table information , Then To Extend the disk type :

Select the partition number
Type the size you want to resize in GB for example to extend the disk to total of 100GB just type 100GB

Next You will need to extend the logical partition

pvresize /dev/sda2 -> this resize partion number 2 to max , or relative 40G: pvresize --setphysicalvolumesize 40G /dev/sda2

Then we need to resize the LVM- > run df -h to see the volumes

 lvresize -l +100%FREE /dev/VolGroup/lv_root    or the root for example :  lvextend -rl +100%FREE /dev/mapper/centos-root

you might get note after resizing the partition :

Information: You may need to update /etc/fstab

Run again pvdisplay and lvdisplay to see all the partition size , you verify resized Partition with lsblk :

root@test:~# lsblk
vda    254:0    0  20G  0 disk 
└─vda1 254:1    0  20G  0 part /
vdb    254:16   0  40G  0 disk 
└─vdb1 254:17   0  40G  0 part 

If the Partition is XFS type you might need to run :

root@test:~# xfs_growfs -d /dev/mapper/centos-root

Then Check with

df -h



 Good Luck

Leave a Reply

Your email address will not be published.