Increase the capacity of an LVM volume group on Linux Systems
In this article, I’ll show you how to increase the capacity of an existing LVM volume group by adding more physical volumes on Linux systems (RPM Family “Redhat / CentOS / Scientific Linux” and Debian Family “Debian / Ubuntu” and other families ). As a system administrator, you will face this scenario many times and you must know how to increase the capacity of an existing LVM volume group by adding more physical volumes for creating more logical volumes or increasing the size of existing logical volumes.
Scenario
Suppose that /dev/vg0
is a volume group composed of three 100GB physical volumes, giving it a total capacity of 300GB. You wish to add two further physical volumes to increase the total capacity to 500GB.
The existing physical volumes are named /dev/sda
, /dev/sdb
and /dev/sdc
. The new ones are named /dev/sdd
and /dev/sde
.
Prerequisites
With older versions of LVM it was necessary for physical volumes to be explicitly initialised using pvcreate
before being added to a volume group. As of version 2.02.54 this is no longer necessary because initialisation will occur automatically if required. Prior initialisation may still be desirable in order to deviate from the default settings used by pvcreate
, obtain better diagnostics by proceeding one step at a time, or retain compatibility with older versions of LVM.
Method
Physical volumes can be added to a volume group using the vgextend
command:
# vgextend vg0 /dev/sdd /dev/sde
The first argument is the name of the volume group to be extended. This can be written as a pathname if you prefer (/dev/vg0
). Subsequent arguments are the physical volumes to be added.
If successful you should see a response of the form:
Volume group "vg0" successfully extended
If the physical volumes have not previously been initialised using pvcreate
then there will be some additional diagnostic messages, for example:
No physical volume label read from /dev/sdd
Physical volume "/dev/sdd" successfully created
No physical volume label read from /dev/sde
Physical volume "/dev/sde" successfully created
Volume group "vg0" successfully extended
Testing
You can check the new capacity of the volume group using the vgs
command:
# vgs vg0
This should give a response of the form:
VG #PV #LV #SN Attr VSize VFree vg0 5 0 0 wz--n- 499.98G 499.98G
Next steps
The extra capacity added to the volume group should now be available for use, either by creating new logical volumes or by expanding the size of existing ones. In the latter case, if the logical volume contains a filesystem then you will probably want to expand that too. See:
for details of some of these processes.
If You Appreciate What We Do Here On Mimastech, You Should Consider:
- Stay Connected to: Facebook | Twitter | Google+
- Support us via PayPal Donation
- Subscribe to our email newsletters.
- Tell other sysadmins / friends about Us - Share and Like our posts and services
We are thankful for your never ending support.