Linux 卷组(VG)扩容

BobAnkh published on
1 min, 88 words

Categories: Linux

本篇文章主要介绍如何进行Linux上的卷组(VG)扩缩容

You can find the English version of this post at here.

查看磁盘情况和硬盘情况

df -h
sudo fdisk -l

查看LVM卷组的信息

sudo vgdisplay

进行卷组的扩缩容

以最常见常用的Ubuntu中的/dev/mapper/ubuntu--vg-ubuntu--lv为例:

# 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

执行扩容命令

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