User Tools

Site Tools


ubuntu:lvm:increase_the_capacity_of_an_lvm_volume_group

Ubuntu - LVM - Increase the capacity of an LVM volume group

To increase the capacity of an existing LVM volume group by adding more physical volumes.

Suppose that /dev/vg01 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 initialized using pvcreate before being added to a volume group. As of version 2.02.54 this is no longer necessary because initialization will occur automatically if required. Prior initialization 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 vg01 /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/vg01). Subsequent arguments are the physical volumes to be added.

If successful you should see a response of the form:

Volume group "vg01" successfully extended

If the physical volumes have not previously been initialized 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 "vg01" 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
  vg01    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:

Increase the size of an LVM logical volume Increase the size of an ext2, ext3 or ext4 filesystem for details of some of these processes.


See also

Troubleshooting

ubuntu/lvm/increase_the_capacity_of_an_lvm_volume_group.txt · Last modified: 2020/07/15 10:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki