Show Table of Contents
4.4.8. Growing Logical Volumes
To increase the size of a logical volume, use the
After extending the logical volume, you will need to increase the size of the associated file system to match.
When you extend the logical volume, you can indicate how much you want to extend the volume, or how large you want it to be after you extend it.
The following command extends the logical volumne
/dev/myvg/homevolto 12 gigabytes.
lvextend -L12G /dev/myvg/homevollvextend -- extending logical volume "/dev/myvg/homevol" to 12 GB lvextend -- doing automatic backup of volume group "myvg" lvextend -- logical volume "/dev/myvg/homevol" successfully extended
The following command adds another gigabyte to the logical volume
lvextend -L+1G /dev/myvg/homevollvextend -- extending logical volume "/dev/myvg/homevol" to 13 GB lvextend -- doing automatic backup of volume group "myvg" lvextend -- logical volume "/dev/myvg/homevol" successfully extended
As with the
lvcreatecommand, you can use the
-largument of the
lvextendcommand to specify the number of extents by which to increase the size of the logical volume. You can also use this argument to specify a percentage of the volume group, or a percentage of the remaining free space in the volume group. The following command extends the logical volume called
testlvto fill all of the unallocated space in the volume group
lvextend -l +100%FREE /dev/myvg/testlvExtending logical volume testlv to 68.59 GB Logical volume testlv successfully resized
After you have extended the logical volume it is necessary to increase the file system size to match.
By default, most file system resizing tools will increase the size of the file system to be the size of the underlying logical volume so you do not need to worry about specifying the same size for each of the two commands.