执行 RAID 接管时出现可分配扩展空间不足错误

执行 RAID 接管时出现可分配扩展空间不足错误

为了在保持冗余的同时提高性能,我尝试将 NAS 的根文件系统从 RAID 5 逻辑卷转换为 RAID 10 逻辑卷,同时保持相同数量的磁盘使用。

手册页的部分lvmraid表明,通过间接转换可以转换 RAID 10 和 RAID 5。

目前可以进行以下收购转换:

...

  • 在 striped/raid0 和 raid5 之间。

...

  • 在 striped/raid0 和 raid10 之间。

但是,当按照提示反复运行适当的lvconvert命令(在类似的testLV 上)执行中间转换时,我在最终从 RAID 0 转换为 RAID 10 的最后一步出现此错误:

root@nas:~# lvcreate --type raid5 -i 3 -n test -L 100M vg
  Using default stripesize 64.00 KiB.
  Rounding size 100.00 MiB (25 extents) up to stripe boundary size 108.00 MiB (27 extents).
  Logical volume "test" created.

root@nas:~# lvconvert vg/test --type raid10 -m 1 -i 2
  Using default stripesize 64.00 KiB.
  Replaced LV type raid10 (same as raid10_near) with possible type raid5_n.
  Repeat this command to convert to raid10 after an interim conversion has finished.
  Converting raid5 (same as raid5_ls) LV vg/test to raid5_n.
Are you sure you want to convert raid5 LV vg/test? [y/n]: y
  Logical volume vg/test successfully converted.

root@nas:~# lvconvert vg/test --type raid10 -m 1 -i 2
  Using default stripesize 64.00 KiB.
  Replaced LV type raid10 (same as raid10_near) with possible type raid0_meta.
  Repeat this command to convert to raid10 after an interim conversion has finished.
Are you sure you want to convert raid5_n LV vg/test to raid0_meta type? [y/n]: y
  Logical volume vg/test successfully converted.

root@nas:~# lvconvert vg/test --type raid10 -m 1 -i 2
  Using default stripesize 64.00 KiB.
Are you sure you want to convert raid0_meta LV vg/test to raid10 type? [y/n]: y
  Insufficient suitable allocatable extents for logical volume : 30 more required

root@nas:~#

即使释放物理范围并减少 LV 大小,我仍然会遇到相同的错误。所有物理卷都是可分配的。

输出如下vgdisplay

  --- Volume group ---
  VG Name               vg
  System ID             
  Format                lvm2
  Metadata Areas        4
  Metadata Sequence No  333
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               2
  Max PV                0
  Cur PV                4
  Act PV                4
  VG Size               <3.64 TiB
  PE Size               4.00 MiB
  Total PE              953864
  Alloc PE / Size       943654 / <3.60 TiB
  Free  PE / Size       10210 / 39.88 GiB
  VG UUID               PF08Ce-xvsS-7KsA-0Vw6-zkXR-jyUf-ocDWDW

我该如何解决此错误?我想对转换后的 LV 使用相同的 PE,并根据需要缩小文件系统。

答案1

为了便于描述,请考虑磁盘表示磁盘、分区或其他逻辑容器。每个磁盘被认为是相同的大小,持有单元存储空间(1GB、1TB,无论什么,都没关系)。

  • RAID 5 使用三个磁盘作为两个有用存储单元
  • RAID 0 使用两个磁盘作为两个有用存储单元
  • RAID 10 使用两个磁盘作为 1 个有用存储单元;通常,RAID 10 可视为 RAID 0(或 vv)之上的 RAID 1,因此您将使用四个磁盘作为 2 个有用存储单元

  • 从 RAID 5 转换为 RAID 0 时,会剩下一个存储单元(即一个磁盘是备用的)
  • 当您从 RAID 0 转换为 RAID 10 时,您需要为转换的每个单元添加一个额外的存储单元(即,在您当前使用的两个磁盘之上添加两个额外的磁盘)

后果:您一开始就有三个磁盘,所以少了一张磁盘。

一个选项可能是看看是否可以将 RAID 0 阵列从使用两个磁盘减少到使用一个磁盘,但这假设您原来的 RAID 5 阵列只有一半满。另一个选项是获取第四个磁盘。

相关内容