试图添加磁盘来镜像CentOS 7上的LVM卷总是失败的,因为“空闲空间不足:需要一个区段,但只有0可用”。搜索解决方案后,我尝试指定磁盘、多个日志记录选项、添加第三个日志分区,但没有找到解决方案。
不确定我是犯了一个新手的错误,还是有一些更微妙的错误(我更熟悉ZFS,刚开始使用LVM):
# lvconvert -m1 centos_bi/home
Insufficient free space: 1 extents needed, but only 0 available
# lvconvert -m1 --corelog centos_bi/home
Insufficient free space: 1 extents needed, but only 0 available
# lvconvert -m1 --corelog --alloc anywhere centos_bi/home
Insufficient free space: 1 extents needed, but only 0 available
# lvconvert -m1 --mirrorlog mirrored --alloc anywhere centos_bi/home /dev/sda2
Insufficient free space: 1 extents needed, but only 0 available
# lvconvert -m1 --corelog --alloc anywhere centos_bi/home /dev/sdi2 /dev/sda2
Insufficient free space: 1 extents needed, but only 0 available这两个磁盘大小相同,通过"sfdisk -d /dev/sdi > part_table;sfdisk /dev/sda < part_table“具有相同的分区布局。下面详细介绍了当前的配置。
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda1 centos_bi lvm2 a-- 496.00m 496.00m
/dev/sda2 centos_bi lvm2 a-- 465.27g 465.27g
/dev/sdi2 centos_bi lvm2 a-- 465.27g 0
# vgs
VG #PV #LV #SN Attr VSize VFree
centos_bi 3 3 0 wz--n- 931.02g 465.75g
# lvs -a -o +devices
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert Devices
home centos_bi -wi-ao---- 391.64g /dev/sdi2(6050)
root centos_bi -wi-ao---- 50.00g /dev/sdi2(106309)
swap centos_bi -wi-ao---- 23.63g /dev/sdi2(0)
# pvdisplay
--- Physical volume ---
PV Name /dev/sdi2
VG Name centos_bi
PV Size 465.27 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 119109
Free PE 0
Allocated PE 119109
--- Physical volume ---
PV Name /dev/sda2
VG Name centos_bi
PV Size 465.27 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 119109
Free PE 119109
Allocated PE 0
--- Physical volume ---
PV Name /dev/sda1
VG Name centos_bi
PV Size 500.00 MiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 124
Free PE 124
Allocated PE 0
# vgdisplay
--- Volume group ---
VG Name centos_bi
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 10
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 3
Act PV 3
VG Size 931.02 GiB
PE Size 4.00 MiB
Total PE 238342
Alloc PE / Size 119109 / 465.27 GiB
Free PE / Size 119233 / 465.75 GiB
# lvdisplay
--- Logical volume ---
LV Path /dev/centos_bi/swap
LV Name swap
VG Name centos_bi
LV Write Access read/write
LV Creation host, time localhost, 2014-08-07 16:34:34 -0400
LV Status available
# open 2
LV Size 23.63 GiB
Current LE 6050
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/centos_bi/home
LV Name home
VG Name centos_bi
LV Write Access read/write
LV Creation host, time localhost, 2014-08-07 16:34:35 -0400
LV Status available
# open 1
LV Size 391.64 GiB
Current LE 100259
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
--- Logical volume ---
LV Path /dev/centos_bi/root
LV Name root
VG Name centos_bi
LV Write Access read/write
LV Creation host, time localhost, 2014-08-07 16:34:37 -0400
LV Status available
# open 1
LV Size 50.00 GiB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0发布于 2015-01-04 01:22:37
自2013年9月以来,lvm2中默认的镜像段类型一直是“raid1”(而不是“镜像”)。这使得--corelog和--mirrorlog disk/core/mirrored选项在这种默认情况下不适用,因为raid1段类型总是将其日志(实际上是元数据子卷)存储在磁盘上,与镜像LV相同(S)。您不再需要第三个PV作为日志,或者将日志存储在内存中。
还有两个进一步的含义。首先,简化了创建镜像的命令,因为只需要指定要镜像的LV,以及存储镜像段的PV:# lvconvert -m1 /dev/my_vg/my_lv /dev/my_new_pv。
第二,有一些空间方面的考虑。你需要:
通常,这个原始的- PV额外的空间需求会导致问题,因为现有的PV中甚至没有为日志分配一个新的LE的空间。在这种情况下,您可能会遇到OP所遇到的错误,即1 extents needed, but only 0 available。
正如其他人前面所指出的,补救方法是调整现有LV的大小(缩小文件系统后收缩),以便在相同的PV上分配日志。如果不能这样做,可以使用--type mirror强制遗留的“镜像”段类型。
https://serverfault.com/questions/623096
复制相似问题