Red Hat Training

A Red Hat training course is available for RHEL 8

9.21. 将 RAID 逻辑卷转换为另一个 RAID 级别

LVM 支持 RAID 接管,这意味着将 RAID 逻辑卷从一个 RAID 级别转换为另一个 RAID 级别,例如从 RAID 5 转换到 RAID 6。您可以更改 RAID 级别,以增加或减少设备故障的恢复能力。

流程

  1. 创建 RAID 逻辑卷:

    # lvcreate --type raid5 -i 3 -L 500M -n my_lv my_vg
    Using default stripesize 64.00 KiB.
    Rounding size 500.00 MiB (125 extents) up to stripe boundary size 504.00 MiB (126 extents).
    Logical volume "my_lv" created.
  2. 查看 RAID 逻辑卷:

    # lvs -a -o +devices,segtype
      LV               VG            Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices                                                                 Type
      my_lv            my_vg         rwi-a-r--- 504.00m                                    100.00           my_lv_rimage_0(0),my_lv_rimage_1(0),my_lv_rimage_2(0),my_lv_rimage_3(0) raid5
      [my_lv_rimage_0] my_vg         iwi-aor--- 168.00m                                                     /dev/sda(1)                                                             linear
  3. 将 RAID 逻辑卷转换为另一个 RAID 级别:

    # lvconvert --type raid6 my_vg/my_lv
    Using default stripesize 64.00 KiB.
    Replaced LV type raid6 (same as raid6_zr) with possible type raid6_ls_6.
    Repeat this command to convert to raid6 after an interim conversion has finished.
    Are you sure you want to convert raid5 LV my_vg/my_lv to raid6_ls_6 type? [y/n]: y
    Logical volume my_vg/my_lv successfully converted.
  4. 可选:如果这个命令提示重复转换,请运行:

    # lvconvert --type raid6 my_vg/my_lv

验证

  1. 查看具有转换的 RAID 级别的 RAID 逻辑卷:

    # lvs -a -o +devices,segtype
      LV               VG            Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices                                                                                   Type
      my_lv            my_vg         rwi-a-r--- 504.00m                                    100.00           my_lv_rimage_0(0),my_lv_rimage_1(0),my_lv_rimage_2(0),my_lv_rimage_3(0),my_lv_rimage_4(0) raid6
      [my_lv_rimage_0] my_vg         iwi-aor--- 172.00m                                                     /dev/sda(1)                                                                               linear

其他资源

  • lvconvert (8)lvmraid (8) 手册页