我有许多 NVME 驱动器,以及如何创建一个 lvm 组并在 NVME 磁盘上剥离数据,以使所有驱动器上的数据更加均匀。我对此很满意。
lvcreate -i 3 -n lg_group vol_group -l 100%FREE
Strip set of 3 disks.
我的问题是。
是否可以添加 4、5、6 NVME 驱动器并将条带从 3 增加到 4、5、6... 添加磁盘时。我在虚拟机上测试了这个。我在那里创建了5个10G磁盘。我创建了一个由 3 个磁盘组成的条带。 /dev/sd[bcd]
parted --script /dev/sdb "mklabel gpt"
parted --script /dev/sdb "mkpart 'LVM2' 0% 100%"
parted --script /dev/sdb "set 1 lvm on"
parted --script /dev/sdc "mklabel gpt"
parted --script /dev/sdc "mkpart 'LVM2' 0% 100%"
parted --script /dev/sdc "set 1 lvm on"
parted --script /dev/sdd "mklabel gpt"
parted --script /dev/sdd "mkpart 'LVM2' 0% 100%"
parted --script /dev/sdd "set 1 lvm on"
parted --script /dev/sdb "mklabel gpt"
parted --script /dev/sdb "mkpart 'LVM2' 0% 100%"
parted --script /dev/sdb "set 1 lvm on"
parted --script /dev/sdc "mklabel gpt"
parted --script /dev/sdc "mkpart 'LVM2' 0% 100%"
parted --script /dev/sdc "set 1 lvm on"
parted --script /dev/sdd "mklabel gpt"
parted --script /dev/sdd "mkpart 'LVM2' 0% 100%"
parted --script /dev/sdd "set 1 lvm on"
pvcreate /dev/sd[bcd]
vgcreate vol_group /dev/sdb1 /dev/sdc1 /dev/sdd1
lvcreate -i 3 -n lg_group vol_group -l 100%FREE
mkfs.ext4 /dev/vol_group/lg_group
e2label /dev/vol_group/lg_group store
mount -a
umount /store
parted --script /dev/sde "mklabel gpt"
parted --script /dev/sde "mkpart 'LVM2' 0% 100%"
parted --script /dev/sde "set 1 lvm on"
pvcreate /dev/sde1
vgextend vol_group /dev/sde1
我可以看到可用空间
root@volgical:/# vgdisplay
--- Volume group ---
VG Name vol_group
System ID
Format lvm2
Metadata Areas 4
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 4
Act PV 4
VG Size 39.98 GiB
PE Size 4.00 MiB
Total PE 10236
Alloc PE / Size 7677 / <29.99 GiB
Free PE / Size 2559 / <10.00 GiB
lvextend -l +100%FREE /dev/vol_group/lg_group
Using stripesize of last segment 64.00 KiB
Size of logical volume vol_group/lg_group unchanged from <29.99 GiB (7677 extents).
Logical volume vol_group/lg_group successfully resized.
e2fsck -f /dev/vol_group/lg_group
e2fsck 1.46.5 (30-Dec-2021)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
store: 13/1966080 files (7.7% non-contiguous), 170263/7861248 blocks
resize2fs -p /dev/vol_group/lg_group
resize2fs 1.46.5 (30-Dec-2021)
The filesystem is already 7861248 (4k) blocks long. Nothing to do!
所以我猜我需要做一些事情来将条带从 3 更改为 4?在我让它长到下一个磁盘之前?
lvs -o+lv_layout,stripes
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Layout #Str
lg_group vol_group -wi-a----- <29.99g