Red Hat Training

A Red Hat training course is available for RHEL 8

9.13. 将镜像 LVM 设备转换为 RAID1 逻辑卷

您可以将片段类型为 mirror 的现有镜像 LVM 设备转换为 RAID1 LVM 设备。要执行此操作,请使用带有 --type raid1 参数的 lvconvert 命令。这会将名为 mimage 的镜像子卷重命名为名为 rimage 的 RAID 子卷。

另外,它还会删除镜像日志,并为同一物理卷上的数据子卷创建名为 rmeta 的元数据子卷,来作为响应的数据子卷。

流程

  1. 查看镜像逻辑卷 my_vg/my_lv 的布局:

    # lvs -a -o name,copy_percent,devices my_vg
      LV               Copy%  Devices
      my_lv             15.20 my_lv_mimage_0(0),my_lv_mimage_1(0)
      [my_lv_mimage_0]        /dev/sde1(0)
      [my_lv_mimage_1]        /dev/sdf1(0)
      [my_lv_mlog]            /dev/sdd1(0)
  2. 将镜像逻辑卷 my_vg/my_lv 转换为 RAID1 逻辑卷:

    # lvconvert --type raid1 my_vg/my_lv
    Are you sure you want to convert mirror LV my_vg/my_lv to raid1 type? [y/n]: y
    Logical volume my_vg/my_lv successfully converted.

验证

  • 验证镜像逻辑卷是否转换为 RAID1 逻辑卷:

    # lvs -a -o name,copy_percent,devices my_vg
      LV               Copy%  Devices
      my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0)
      [my_lv_rimage_0]        /dev/sde1(0)
      [my_lv_rimage_1]        /dev/sdf1(0)
      [my_lv_rmeta_0]         /dev/sde1(125)
      [my_lv_rmeta_1]         /dev/sdf1(125)

其他资源

  • lvconvert (8) 手册页