The Linux Newbie Guide  ⇒    Fundamentals     Advanced     Supplement   Command Index   ENG⇒中
All rights reserved, please indicate the source when citing
  

lvresize - Resize LV






lvresize' is a command in the context of LVM (Logical Volume Manager) and is used to resize a logical volume (LV), either by increasing or decreasing its size. When used to increase the LV's capacity, it is equivalent to the lvextend command, and when used to decrease the LV's capacity, it is equivalent to the lvreduce command.

Example:

# Enlarge LV (steps)
# lvresize -L 8G dev/myVG/myLV ←Enlarge the LV to 8GB (original size was 7GB)
# resize2fs /dev/myVG/myLV ←Adjust the filesystem size accordingly

# Reduce LV (steps) - Note that reducing LV size might result in data loss
# e2fsck -f /dev/myVG/myLV ←Scan and check VG
# resize2fs /dev/myVG/myLV 5G ←Shrink the filesystem to 5GB (original size was 8GB)
# lvresize -L 5G /dev/myVG/myLV ←educe the LV to 5GB

The above operations are only applicable to ext2/ext3/ext4 filesystems. Please be cautious when using 'lvresize' as resizing LVs can have significant consequences, especially when shrinking an LV, which may result in data loss.