尝试添加磁盘以在CentOS 7上镜像LVM卷时总是失败,并显示“可用空间不足:需要1个扩展盘区,但只能使用0个”。 已经search了一个解决scheme,我已经尝试指定磁盘,多个日志logging选项,添加第三个日志分区,但还没有find解决scheme
不知道我是否犯了一个新手的错误,或者是有一些更微妙的错误(我更熟悉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”具有相同的分区布局。 当前configuration在下面详述。
# 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
自2013年9月左右以来,lvm2中的默认镜像段types为“raid1”(不是“镜像”)。 这使得--corelog和--mirrorlog disk/core/mirrored选项在这种默认情况下不适用,因为raid1段types始终将其日志(实际上是元数据子卷)存储在与LV相同的PV上的磁盘上镜像。 您不再需要第三个PV作为日志,或者将日志存储在内存中。
还有两个含义。 首先,创build镜像的命令被简化了,因为只需要指定要镜像的LV,以及镜像段将被存储的PV(通常是一个): # lvconvert -m1 /dev/my_vg/my_lv /dev/my_new_pv
其次,有一些空间的考虑。 你需要有:
通常,这种原始的PV额外空间要求会导致一个问题,因为即使为该日志分配一个新的LE,现有PV中也没有空间。 在这种情况下,您可能会遇到OP所遇到的错误,即1 extents needed, but only 0 available 。
正如其他人所指出的那样,补救措施是调整现有LV的大小(收缩文件系统后缩小),因此在相同的PV上可以分配日志。 如果你不能做到这一点,你可以使用 – --type mirror来强制传统的“镜像”细分types。