Linux 卷组(VG)扩容

Written By BobAnkh, 2023-01-15(Sun), in Category Linux

Linux, Server, Ubuntu

摘要

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

查看磁盘情况和硬盘情况

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 lvextend -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

Other Articles

Previous Article: 关于Rust中Memory Container使用Cheatsheet的分享