假设我创建了以下 Linux LVM 卷组和逻辑卷:
$ sudo vgcreate vg1 /dev/sdb1
$ sudo lvcreate -L 10G -n lv1 vg1
$ sudo lvcreate -L 10G -n lv2 vg1
$ sudo lvcreate -L 10G -n lv3 vg1
$ sudo mkfs.ext4 /dev/mapper/vg1-lv1
$ sudo mkfs.ext4 /dev/mapper/vg1-lv2
$ sudo mkfs.ext4 /dev/mapper/vg1-lv3
我最终得到以下内容,它们都将使用 ext4 文件系统:
$ sudo lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv1 vg1 -wi-a----- 10.00g
lv2 vg1 -wi-a----- 10.00g
lv3 vg1 -wi-a----- 10.00g
我想将lv1 大小从 10G减少到 5G,并将lv2大小从 10G 增加到 15G。这意味着 lv2 需要向磁盘的前端增长。
$ sudo lvreduce --resizefs --size 5G /dev/mapper/vg1-lv1
fsck from util-linux 2.36.1
/dev/mapper/vg1-lv1: clean, 11/655360 files, 66753/2621440 blocks
resize2fs 1.46.3 (27-Jul-2021)
Resizing the filesystem on /dev/mapper/vg1-lv1 to 1310720 (4k) blocks.
The filesystem on /dev/mapper/vg1-lv1 is now 1310720 (4k) blocks long.
Size of logical volume vg1/lv1 changed from 10.00 GiB (2560 extents) to 5.00 GiB (1280 extents).
Logical volume vg1/lv1 successfully resized.
降低 lv1 似乎奏效了。我现在如何成长lv2?