[CentOS] Increase Disk Space with LVM

Louis Lagendijk louis at fazant.net
Tue Jul 31 12:13:27 UTC 2018


On Tue, 2018-07-31 at 13:31 +0200, Felix Kölzow wrote:
> 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

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)

>  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
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

>  5. resize2fs /dev/centos/root or xfs_grows /dev/centos/root
> depending
>     on file system used
See above, if you use the -r option on the lvextend this step is not
needed

>  6. repeat steps 2-6 for /home and sdb2
> 
See above: this is only required when you have more than one VG.





More information about the CentOS mailing list