Installation guide

Growing Logical Volumes
45
The following command adds another physical volume to the volume group, which then has 135G of
additional space.
# vgextend vg /dev/sdc1
Volume group "vg" successfully extended
# vgs
VG #PV #LV #SN Attr VSize VFree
vg 3 1 0 wz--n- 406.97G 135.66G
At this point you cannot extend the striped logical volume to the full size of the volume group, because
two underlying devices are needed in order to stripe the data.
# lvextend vg/stripe1 -L 406G
Using stripesize of last segment 64.00 KB
Extending logical volume stripe1 to 406.00 GB
Insufficient suitable allocatable extents for logical volume stripe1: 34480
more required
To extend the striped logical volume, add another physical volume and then extend the logical volume.
In this example, having added two physical volumes to the volume group we can extend the logical
volume to the full size of the volume group.
# vgextend vg /dev/sdd1
Volume group "vg" successfully extended
# vgs
VG #PV #LV #SN Attr VSize VFree
vg 4 1 0 wz--n- 542.62G 271.31G
# lvextend vg/stripe1 -L 542G
Using stripesize of last segment 64.00 KB
Extending logical volume stripe1 to 542.00 GB
Logical volume stripe1 successfully resized
If you do not have enough underlying physical devices to extend the striped logical volume, it is
possible to extend the volume anyway if it does not matter that the extension is not striped, which
may result in uneven performance. When adding space to the logical volume, the default operation
is to use the same striping parameters of the last segment of the existing logical volume, but you can
override those parameters. The following example extends the existing striped logical volume to use
the remaining free space after the initial lvextend command fails.
# lvextend vg/stripe1 -L 406G
Using stripesize of last segment 64.00 KB
Extending logical volume stripe1 to 406.00 GB
Insufficient suitable allocatable extents for logical volume stripe1: 34480
more required
# lvextend -i1 -l+100%FREE vg/stripe1
4.4.12.2. Extending a Logical Volume with the cling Allocation Policy
When extending an LVM volume, you can use the --alloc cling option of the lvextend
command to specify the cling allocation policy. This policy will choose space on the same physical
volumes as the last segment of the existing logical volume. If there is insufficient space on the physical
volumes and a list of tags is defined in the lvm.conf file, LVM will check whether any of the tags are
attached to the physical volumes and seek to match those physical volume tags between existing
extents and new extents.