linux – LVM镜像尝试导致“可用空间不足”

前端之家收集整理的这篇文章主要介绍了linux – LVM镜像尝试导致“可用空间不足”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
尝试添加磁盘以镜像CentOS 7上的LVM卷总是失败,“可用空间不足:需要1个扩展区,但只有0个可用”.在搜索解决方案之后,我尝试了指定磁盘,多个日志记录选项,添加第3个日志分区,但还没有找到解决方

不确定我是否犯了一个新手错误,或者有更微妙的错误(我更熟悉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,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,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
@H_301_11@解决方法
从2013年9月左右开始,lvm2中的默认镜像段类型为’raid1′(不是’镜像’).这使得–corelog和–mirrorlog磁盘/核心/镜像选项在此默认情况下不适用,因为raid1段类型始终将其日志(实际上是元数据子卷)存储在与LV相同的PV上的磁盘上镜像.您不再需要第三个PV用于日志,或将日志存储在内存中.

还有两个含义.首先,简化了创建镜像的命令,因为只需要指定要镜像的LV,以及将存储镜像段的(通常是一个)PV:#lvconvert -m1 / dev / my_vg / my_lv / dev / my_new_pv

其次,有几个空间考虑因素.你需要:

>显然,镜子PV上的空间存放了原始LV的副本,
>还要在镜子PV上增加1个LE来存储日志,
>并且(这是我错过了一段时间的点),原始PV上的1个额外LE,用于存储日志(因为日志存储在原始PV和新PV上).

通常这种原始PV附加空间要求会导致问题,因为即使为日志分配了1个新LE,现有PV中也没有空间.在这种情况下,您可能会遇到OP遇到的错误,即需要1个扩展区,但只有0个可用.

如上所述,补救措施是在现有LV上调整大小(缩小文件系统后缩小),因此可以在同一PV上分配日志.如果你不能这样做,你可以使用–type mirror来强制传统的’镜像’段类型.

原文链接:https://www.f2er.com/linux/398930.html

猜你在找的Linux相关文章