執行 RAID 接管時出現適當的可分配範圍不足錯誤

執行 RAID 接管時出現適當的可分配範圍不足錯誤

為了在保持冗餘的同時提高效能,我嘗試將 NAS 的根檔案系統從 RAID 5 邏輯磁碟區轉換為 RAID 10 邏輯卷,同時保持使用的磁碟數量相同。

在手冊頁的部分中lvmraid,它建議可以透過間接轉換來轉換 RAID 10 和 RAID 5。

目前可以進行以下接管轉換:

  • 介於 striped/raid0 和 raid5 之間。

  • 介於 striped/raid0 和 raid10 之間。

lvconvert但是,當(在類似的 LV 上)執行適當的命令時test,請按照提示重複執行中間轉換,最終從 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 使用兩個磁碟作為一個有用儲存單元;通常,RAID 10 可以被視為 RAID 0(或 vv)之上的 RAID 1,因此您可以使用四個磁碟作為兩個有用儲存單元

  • 當您從 RAID 5 轉換為 RAID 0 時,您會剩餘 1 個儲存單元(即 1 個磁碟是備用的)
  • 當您從 RAID 0 轉換為 RAID 10 時,您需要為要轉換的每個單元添加一個額外的儲存單元(即,在目前使用的兩個磁碟之上添加兩個額外的磁碟)

結果:您一開始使用了三塊磁碟,因此缺少一張磁碟。

一種選擇可能是看看是否可以將 RAID 0 陣列從使用兩個磁碟減少到一個,但這前提是您的原始 RAID 5 陣列僅佔了一半。另一個選擇是取得第四個磁碟。

相關內容