Please come back for more

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 with the device you want to change like :

parted -l  (disk list)
parted /dev/sda print -> to see the disk partition print free -> to see free space resizeparted -> to resize partition select the partition number you want to change enter the size you can from the free size in gigabit 30GB (the default size is in bytes) quit -> exit the program 

Then Extend the disk follow this step by setp:

fdisk -l  -> the check what partition need to extended
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 se the volumes
lvresize -l +100%FREE /dev/VolGroup/lv_root    or the root for examle :  lvextend -rl +100%FREE /dev/mapper/centos-root

Run again pvdisplay and lvdisplay to see all the partition size


 Good Luck

Leave a Reply

Your email address will not be published. Required fields are marked *