如何在 lvm raid 5 上扩展逻辑卷

如何在 lvm raid 5 上扩展逻辑卷

抱歉我的英语不好...

我在 lvm2 上有 4 个 3TB 磁盘,并使用 raid 5 创建了 lv。

我在卷组上添加了 2 个新磁盘并尝试扩展 lv,但它不起作用。

这是我的 vg 状态。


# vgdisplay 
  --- Volume group ---
  VG Name               vg2
  System ID             
  Format                lvm2
  Metadata Areas        5
  Metadata Sequence No  43
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                5
  Act PV                5
  VG Size               13.65 TiB
  PE Size               4.00 MiB
  Total PE              3576980
  Alloc PE / Size       2861584 / 10.92 TiB
  Free  PE / Size       715396 / 2.73 TiB
  VG UUID               h5w1kW-pdym-Na7U-dRHf-9Xk5-NX3F-GA19Uf

这是我的 lv 状态。


# lvs
  LV   VG   Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv2  vg2  rwi-a-r--- 8.19t  
# lvdisplay 
  --- Logical volume ---
  LV Path                /dev/vg2/lv2
  LV Name                lv2
  VG Name                vg2
  LV UUID                aaC9Qc-1Yev-rfyh-fzZh-K32v-nRsj-Bf3msZ
  LV Write Access        read/write
  LV Creation host, time , 
  LV Status              available
  # open                 0
  LV Size                8.19 TiB
  Current LE             2146185
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     1024
  Block device           253:8

这是lvextend执行结果。


# lvextend -v  -l +100%FREE /dev/vg2/lv2
    Converted 100%FREE into at most 715396 physical extents.
  Using stripesize of last segment 64.00 KiB
    Archiving volume group "vg2" metadata (seqno 43).
    Extending logical volume vg2/lv2 to up to 10.92 TiB
    Found fewer allocatable extents for logical volume lv2 than requested: using 2146185 extents (reduced by 715395).
  Size of logical volume vg2/lv2 unchanged from 8.19 TiB (2146185 extents).
    Loading vg2-lv2_rimage_3 table (253:7)
    Suppressed vg2-lv2_rimage_3 (253:7) identical table reload.
    Loading vg2-lv2_rmeta_3 table (253:6)
    Suppressed vg2-lv2_rmeta_3 (253:6) identical table reload.
    Loading vg2-lv2_rimage_2 table (253:5)
    Suppressed vg2-lv2_rimage_2 (253:5) identical table reload.
    Loading vg2-lv2_rmeta_2 table (253:4)
    Suppressed vg2-lv2_rmeta_2 (253:4) identical table reload.
    Loading vg2-lv2_rimage_1 table (253:3)
    Suppressed vg2-lv2_rimage_1 (253:3) identical table reload.
    Loading vg2-lv2_rmeta_1 table (253:2)
    Suppressed vg2-lv2_rmeta_1 (253:2) identical table reload.
    Loading vg2-lv2_rimage_0 table (253:1)
    Suppressed vg2-lv2_rimage_0 (253:1) identical table reload.
    Loading vg2-lv2_rmeta_0 table (253:0)
    Suppressed vg2-lv2_rmeta_0 (253:0) identical table reload.
    Loading vg2-lv2 table (253:8)
    Suppressed vg2-lv2 (253:8) identical table reload.
    Not monitoring vg2/lv2
    Suspending vg2-lv2 (253:8) with device flush
    Suspending vg2-lv2_rimage_3 (253:7) with device flush
    Suspending vg2-lv2_rmeta_3 (253:6) with device flush
    Suspending vg2-lv2_rimage_2 (253:5) with device flush
    Suspending vg2-lv2_rmeta_2 (253:4) with device flush
    Suspending vg2-lv2_rimage_1 (253:3) with device flush
    Suspending vg2-lv2_rmeta_1 (253:2) with device flush
    Suspending vg2-lv2_rimage_0 (253:1) with device flush
    Suspending vg2-lv2_rmeta_0 (253:0) with device flush
    Loading vg2-lv2_rimage_3 table (253:7)
    Suppressed vg2-lv2_rimage_3 (253:7) identical table reload.
    Loading vg2-lv2_rmeta_3 table (253:6)
    Suppressed vg2-lv2_rmeta_3 (253:6) identical table reload.
    Loading vg2-lv2_rimage_2 table (253:5)
    Suppressed vg2-lv2_rimage_2 (253:5) identical table reload.
    Loading vg2-lv2_rmeta_2 table (253:4)
    Suppressed vg2-lv2_rmeta_2 (253:4) identical table reload.
    Loading vg2-lv2_rimage_1 table (253:3)
    Suppressed vg2-lv2_rimage_1 (253:3) identical table reload.
    Loading vg2-lv2_rmeta_1 table (253:2)
    Suppressed vg2-lv2_rmeta_1 (253:2) identical table reload.
    Loading vg2-lv2_rimage_0 table (253:1)
    Suppressed vg2-lv2_rimage_0 (253:1) identical table reload.
    Loading vg2-lv2_rmeta_0 table (253:0)
    Suppressed vg2-lv2_rmeta_0 (253:0) identical table reload.
    Loading vg2-lv2 table (253:8)
    Suppressed vg2-lv2 (253:8) identical table reload.
    Resuming vg2-lv2_rimage_3 (253:7)
    Resuming vg2-lv2_rmeta_3 (253:6)
    Resuming vg2-lv2_rimage_2 (253:5)
    Resuming vg2-lv2_rmeta_2 (253:4)
    Resuming vg2-lv2_rimage_1 (253:3)
    Resuming vg2-lv2_rmeta_1 (253:2)
    Resuming vg2-lv2_rimage_0 (253:1)
    Resuming vg2-lv2_rmeta_0 (253:0)
    Resuming vg2-lv2 (253:8)
    Monitoring vg2/lv2
    Creating volume group backup "/etc/lvm/backup/vg2" (seqno 44).
  Logical volume lv2 successfully resized.

我该如何扩展我的 lv?


更新

我试图覆盖分配策略,但结果是一样的。


# lvextend -v --alloc normal  -l +100%FREE /dev/vg2/lv2
    Converted 100%FREE into at most 715392 physical extents.
  Using stripesize of last segment 64.00 KiB
    Archiving volume group "vg2" metadata (seqno 52).
    Extending logical volume vg2/lv2 to up to 10.92 TiB
    Found fewer allocatable extents for logical volume lv2 than requested: using 2146188 extents (reduced by 715392).
  Size of logical volume vg2/lv2 unchanged from 8.19 TiB (2146188 extents).
    Loading vg2-lv2_rimage_3 table (253:7)
    Suppressed vg2-lv2_rimage_3 (253:7) identical table reload.
    Loading vg2-lv2_rmeta_3 table (253:6)
    Suppressed vg2-lv2_rmeta_3 (253:6) identical table reload.
    Loading vg2-lv2_rimage_2 table (253:5)
    Suppressed vg2-lv2_rimage_2 (253:5) identical table reload.
    Loading vg2-lv2_rmeta_2 table (253:4)
    Suppressed vg2-lv2_rmeta_2 (253:4) identical table reload.
    Loading vg2-lv2_rimage_1 table (253:3)
    Suppressed vg2-lv2_rimage_1 (253:3) identical table reload.
    Loading vg2-lv2_rmeta_1 table (253:2)
    Suppressed vg2-lv2_rmeta_1 (253:2) identical table reload.
    Loading vg2-lv2_rimage_0 table (253:1)
    Suppressed vg2-lv2_rimage_0 (253:1) identical table reload.
    Loading vg2-lv2_rmeta_0 table (253:0)
    Suppressed vg2-lv2_rmeta_0 (253:0) identical table reload.
    Loading vg2-lv2 table (253:8)
    Suppressed vg2-lv2 (253:8) identical table reload.
    Not monitoring vg2/lv2
    Suspending vg2-lv2 (253:8) with device flush
    Suspending vg2-lv2_rimage_3 (253:7) with device flush
    Suspending vg2-lv2_rmeta_3 (253:6) with device flush
    Suspending vg2-lv2_rimage_2 (253:5) with device flush
    Suspending vg2-lv2_rmeta_2 (253:4) with device flush
    Suspending vg2-lv2_rimage_1 (253:3) with device flush
    Suspending vg2-lv2_rmeta_1 (253:2) with device flush
    Suspending vg2-lv2_rimage_0 (253:1) with device flush
    Suspending vg2-lv2_rmeta_0 (253:0) with device flush
    Loading vg2-lv2_rimage_3 table (253:7)
    Suppressed vg2-lv2_rimage_3 (253:7) identical table reload.
    Loading vg2-lv2_rmeta_3 table (253:6)
    Suppressed vg2-lv2_rmeta_3 (253:6) identical table reload.
    Loading vg2-lv2_rimage_2 table (253:5)
    Suppressed vg2-lv2_rimage_2 (253:5) identical table reload.
    Loading vg2-lv2_rmeta_2 table (253:4)
    Suppressed vg2-lv2_rmeta_2 (253:4) identical table reload.
    Loading vg2-lv2_rimage_1 table (253:3)
    Suppressed vg2-lv2_rimage_1 (253:3) identical table reload.
    Loading vg2-lv2_rmeta_1 table (253:2)
    Suppressed vg2-lv2_rmeta_1 (253:2) identical table reload.
    Loading vg2-lv2_rimage_0 table (253:1)
    Suppressed vg2-lv2_rimage_0 (253:1) identical table reload.
    Loading vg2-lv2_rmeta_0 table (253:0)
    Suppressed vg2-lv2_rmeta_0 (253:0) identical table reload.
    Loading vg2-lv2 table (253:8)
    Suppressed vg2-lv2 (253:8) identical table reload.
    Resuming vg2-lv2_rimage_3 (253:7)
    Resuming vg2-lv2_rmeta_3 (253:6)
    Resuming vg2-lv2_rimage_2 (253:5)
    Resuming vg2-lv2_rmeta_2 (253:4)
    Resuming vg2-lv2_rimage_1 (253:3)
    Resuming vg2-lv2_rmeta_1 (253:2)
    Resuming vg2-lv2_rimage_0 (253:1)
    Resuming vg2-lv2_rmeta_0 (253:0)
    Resuming vg2-lv2 (253:8)
    Monitoring vg2/lv2
    Creating volume group backup "/etc/lvm/backup/vg2" (seqno 53).
  Logical volume lv2 successfully resized.


# vgs -oname,vg_attr,extendable
  VG   Attr   Extendable
  vg2  wz--n- extendable

我改变了 lv 分配策略,但lvextend仍然说范围不足。


# lvchange --alloc normal vg2/lv2
  Logical volume "lv2" changed.

# lvs
  LV   VG   Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv2  vg2  rwn-a-r--- 8.19t                                    100.00   
# lvextend -v --alloc normal  -l +100%FREE /dev/vg2/lv2
    Converted 100%FREE into at most 715392 physical extents.
  Using stripesize of last segment 64.00 KiB
    Archiving volume group "vg2" metadata (seqno 52).
    Extending logical volume vg2/lv2 to up to 10.92 TiB
    Found fewer allocatable extents for logical volume lv2 than requested: using 2146188 extents (reduced by 715392).
  Size of logical volume vg2/lv2 unchanged from 8.19 TiB (2146188 extents).
    Loading vg2-lv2_rimage_3 table (253:7)
    Suppressed vg2-lv2_rimage_3 (253:7) identical table reload.
    Loading vg2-lv2_rmeta_3 table (253:6)
    Suppressed vg2-lv2_rmeta_3 (253:6) identical table reload.
    Loading vg2-lv2_rimage_2 table (253:5)
    Suppressed vg2-lv2_rimage_2 (253:5) identical table reload.
    Loading vg2-lv2_rmeta_2 table (253:4)
    Suppressed vg2-lv2_rmeta_2 (253:4) identical table reload.
    Loading vg2-lv2_rimage_1 table (253:3)
    Suppressed vg2-lv2_rimage_1 (253:3) identical table reload.
    Loading vg2-lv2_rmeta_1 table (253:2)
    Suppressed vg2-lv2_rmeta_1 (253:2) identical table reload.
    Loading vg2-lv2_rimage_0 table (253:1)
    Suppressed vg2-lv2_rimage_0 (253:1) identical table reload.
    Loading vg2-lv2_rmeta_0 table (253:0)
    Suppressed vg2-lv2_rmeta_0 (253:0) identical table reload.
    Loading vg2-lv2 table (253:8)
    Suppressed vg2-lv2 (253:8) identical table reload.
    Not monitoring vg2/lv2
    Suspending vg2-lv2 (253:8) with device flush
    Suspending vg2-lv2_rimage_3 (253:7) with device flush
    Suspending vg2-lv2_rmeta_3 (253:6) with device flush
    Suspending vg2-lv2_rimage_2 (253:5) with device flush
    Suspending vg2-lv2_rmeta_2 (253:4) with device flush
    Suspending vg2-lv2_rimage_1 (253:3) with device flush
    Suspending vg2-lv2_rmeta_1 (253:2) with device flush
    Suspending vg2-lv2_rimage_0 (253:1) with device flush
    Suspending vg2-lv2_rmeta_0 (253:0) with device flush
    Loading vg2-lv2_rimage_3 table (253:7)
    Suppressed vg2-lv2_rimage_3 (253:7) identical table reload.
    Loading vg2-lv2_rmeta_3 table (253:6)
    Suppressed vg2-lv2_rmeta_3 (253:6) identical table reload.
    Loading vg2-lv2_rimage_2 table (253:5)
    Suppressed vg2-lv2_rimage_2 (253:5) identical table reload.
    Loading vg2-lv2_rmeta_2 table (253:4)
    Suppressed vg2-lv2_rmeta_2 (253:4) identical table reload.
    Loading vg2-lv2_rimage_1 table (253:3)
    Suppressed vg2-lv2_rimage_1 (253:3) identical table reload.
    Loading vg2-lv2_rmeta_1 table (253:2)
    Suppressed vg2-lv2_rmeta_1 (253:2) identical table reload.
    Loading vg2-lv2_rimage_0 table (253:1)
    Suppressed vg2-lv2_rimage_0 (253:1) identical table reload.
    Loading vg2-lv2_rmeta_0 table (253:0)
    Suppressed vg2-lv2_rmeta_0 (253:0) identical table reload.
    Loading vg2-lv2 table (253:8)
    Suppressed vg2-lv2 (253:8) identical table reload.
    Resuming vg2-lv2_rimage_3 (253:7)
    Resuming vg2-lv2_rmeta_3 (253:6)
    Resuming vg2-lv2_rimage_2 (253:5)
    Resuming vg2-lv2_rmeta_2 (253:4)
    Resuming vg2-lv2_rimage_1 (253:3)
    Resuming vg2-lv2_rmeta_1 (253:2)
    Resuming vg2-lv2_rimage_0 (253:1)
    Resuming vg2-lv2_rmeta_0 (253:0)
    Resuming vg2-lv2 (253:8)
    Monitoring vg2/lv2
    Creating volume group backup "/etc/lvm/backup/vg2" (seqno 53).
  Logical volume lv2 successfully resized.

编辑

结果如下pvdisplay/dev/sdb1可分配


# pvdisplay 
  --- Physical volume ---
  PV Name               /dev/sdg1
  VG Name               vg2
  PV Size               2.73 TiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              715396
  Free PE               0
  Allocated PE          715396
  PV UUID               QzjE6n-FRSj-NloW-ejFv-B0i0-lfqn-1O03Vu

  --- Physical volume ---
  PV Name               /dev/sdc1
  VG Name               vg2
  PV Size               2.73 TiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              715396
  Free PE               0
  Allocated PE          715396
  PV UUID               bwFwkf-d2zz-1TQR-PR11-IsgN-0P2n-BYMhfW

  --- Physical volume ---
  PV Name               /dev/sde1
  VG Name               vg2
  PV Size               2.73 TiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              715396
  Free PE               0
  Allocated PE          715396
  PV UUID               fWnIz6-Jgf3-QpPW-VKvr-Od1H-cFAp-UrQe6E

  --- Physical volume ---
  PV Name               /dev/sdf1
  VG Name               vg2
  PV Size               2.73 TiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              715396
  Free PE               0
  Allocated PE          715396
  PV UUID               e5rd2D-Xsh8-HD93-KVDs-TtPC-2sM1-i1AROl

  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               vg2
  PV Size               2.73 TiB / not usable 3.00 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              715396
  Free PE               715392
  Allocated PE          4
  PV UUID               SrIKSJ-RzON-Kelu-rC0O-8rLd-rIpI-Fkd1BW

答案1

我意识到 lvm 不支持 raid 类型从 raid 5 更改为 raid 6。

我计划在添加 2 个磁盘后将 raid 5 更改为 raid 6。

现在我改变计划了。

  1. 删除 lv 上可以从其他存储中恢复的数据。
  2. 使用 3 或 4 个磁盘创建降级的 mdadm raid 6 存储。
  3. 将所有数据从 lvm raid 5 移动到降级的 raid 6 存储。
  4. 销毁 lvm raid 并将所有 lvm 磁盘添加到降级的 raid 6。
  5. 重建 raid 6 存储并检索已删除的数据。

我不确定这个计划是否好,无论如何现在我知道 lvm raid 不是管理存储的好选择。

我将关闭我的帖子,我的斗争已经结束了。;)

相关内容