Lvresize Command Guide
The lvresize command is a powerful utility in Linux for
managing Logical Volume Management (LVM) storage. It allows you to
resize logical volumes, which are essentially partitions within a
volume group. This is crucial for adapting your storage to changing
needs, whether you need to expand space for growing applications or
reclaim space from underutilized volumes.
Resize Logical Volume to Specific Size
To resize a logical volume to an exact specified size, use the
-L option followed by the desired size and the logical
volume path.
# lvresize -L [size] [logical_volume]
Increase Logical Volume Size
To increase the size of a logical volume by a specific amount, use the
-L option with a plus sign before the size.
# lvresize -L +[size] [logical_volume]
Reduce Logical Volume Size
To reduce the size of a logical volume by a specific amount, use the
-L option with a minus sign before the size.
# lvresize -L -[size] [logical_volume]
Resize and Extend Filesystem
The -r flag automatically resizes the underlying
filesystem after the logical volume has been resized, simplifying the
process.
# lvresize -r -L [size] [logical_volume]
Resize to Percentage of Volume Group Size
You can resize a logical volume to occupy a certain percentage of the total volume group size.
# lvresize -l [percentage]%VG [logical_volume]
Increase Size by Percentage
Increase the logical volume's size by a percentage of its current size.
# lvresize -l +[percentage]% [logical_volume]
Reduce Size by Percentage
Reduce the logical volume's size by a percentage of its current size.
# lvresize -l -[percentage]% [logical_volume]
Resize to Fill Free Space
To make a logical volume occupy all remaining free space in its volume
group, use 100%FREE.
# lvresize -l 100%FREE [logical_volume]
Resize Without Filesystem Check
If you need to resize without performing a filesystem check (use with
caution), employ the --nofsck option.
# lvresize --nofsck -L [size] [logical_volume]