Increase Disk Space With LVM

Home » CentOS » Increase Disk Space With LVM
CentOS 1 Comment

Dear CentOS-Community,

we have a server with four hard drives that are configured as raid10
(/dev/sda).

Now, /home and /root are almost full. Therefore, we decided to buy four

additional hard drives that should configured also as raid 10 (/dev/sdb).

I want to use LVM to extend disk space for root and home.

My (successful) test procedure in a virtual environment looks like this:

1. devide /dev/sdb into /dev/sdb1 for root and /dev/sdb2 for home using
parted
2. Convert disk to physical volume: pvcreate /dev/sdb1
3. add physical volume to volume group (called CentOS): vgextend CentOS
/dev/sdb1
4. Allocate physical volume to a logical volume:lvextend -l +100$FREE
/dev/CentOS/root
5. resize2fs /dev/CentOS/root or xfs_grows /dev/CentOS/root depending
on file system used
6. repeat steps 2-6 for /home and sdb2

The mentioned instruction I’ve got from this page:

https://askubuntu.com/questions/458476/adding-disks-with-lvm#459176

Now my question:

Is this procedure really safe or is something missing or are there some steps

which I overlooked actually?

Kind Regards

Felix Kölzow

One thought on - Increase Disk Space With LVM

  • How many volume groups do you have: I would assume only one? If so, just create a single partition and add that to the VG. lvm will take care of the rest… What does the vgs command report?

    Are you using a RAID controller? If not you need to create the raid array first (and the disk names may be some mdxxx instead)

    Just a nitpick: This just allocates space from the VG (that got more space by adding the new disks), but if there is space in the PV on the old disk that might get allocated instead. Anyhow this looks ok, but I recommend to add the -r option, that will resize the file system in the same step

    See above, if you use the -r option on the lvextend this step is not needed

    See above: this is only required when you have more than one VG.