lvextend

From RaySoft

lvextend allows you to extend the size of a logical volume. Extension of snapshot logical volumes (see lvcreate for information to create snapshots) is supported as well. But to change the number of copies in a mirrored logical volume use lvconvert.[1]

Documentation

Syntax

lvextend [PARAMETER ...] NAME|PATH

Parameters

-l [+]SIZE%{VG|LV|FREE}, --extents [+]SIZE%{VG|LV|FREE}
Extend or set the logical volume SIZE in units of logical extents. With the + sign the value is added to the actual size of the logical volume and without it, the value is taken as an absolute one. The number can also be expressed as a percentage of the total space in the Volume Group with the suffix %VG or relative to the existing size of the Logical Volume with the suffix %LV or as a percentage of the remaining free space in the Volume Group with the suffix %FREE.
-L [+]SIZE, --size [+]SIZE
Extend or set the logical volume SIZE. With the + sign the value is added to the actual size of the logical volume and without it, the value is taken as an absolute one.
A size suffix is optional (Default unit is megabytes):
  • K for kilobytes
  • M for megabytes
  • G for gigabytes
  • T for terabytes

Examples

Add 40 GB to the partition /dev/xeon_01/lv_export
umount '/export'
lvextend --size '+40G' '/dev/xeon_01/lv_export'
resize2fs '/dev/xeonn_01/lv_export'
mount '/export'
Add a hard disk to the LVM and to the partition /dev/xeon_01/lv_export
umount '/export'
fdisk '/dev/sdb'

Add a new primary partition with n and use the whole space. Change the partition type to 8e (Linux LVM) with t. Review the changes with p. Save and exit with w.

pvcreate '/dev/sdb1'
vgextend 'xeon_01' '/dev/sdb1'
pvscan
lvextend --extents '+100%FREE' '/dev/xeon_01/lv_export'
resize2fs '/dev/xeon_01/lv_export'
mount '/export'

References

  1. man 8 'lvextend'