Extend Volume Group (VG) of Linux

BobAnkh published on
1 min, 62 words

Categories: Linux

This post mainly introduce how to resize the Volume Group of Linux.

你可以在这里找到本篇文章的中文版本.

check for disk and partition

df -h
sudo fdisk -l

Check for LVM Volume Group

sudo vgdisplay

Resize the Volume Group

Take /dev/mapper/ubuntu--vg-ubuntu--lv as an example:

# Extend to exactly 10G
sudo lvextend -L 10G /dev/mapper/ubuntu--vg-ubuntu--lv
# Add 10G extra space to the vg
sudo lvextend -L +10G /dev/mapper/ubuntu--vg-ubuntu--lv
# Reduce 10G space of the vg
sudo lvreduce -L -10G /dev/mapper/ubuntu--vg-ubuntu--lv
# Extend to the maximum size(according to percentage)
sudo lvresize -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv

Execute the Resize Command

sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv