搜索

此内容没有您所选择的语言版本。

5.4.16.5. Changing the Number of Images in an Existing RAID1 Device

download PDF
You can change the number of images in an existing RAID1 array just as you can change the number of images in the earlier implementation of LVM mirroring, by using the lvconvert command to specify the number of additional metadata/data subvolume pairs to add or remove. For information on changing the volume configuration in the earlier implementation of LVM mirroring, see Section 5.4.3.4, “Changing Mirrored Volume Configuration”.
When you add images to a RAID1 device with the lvconvert command, you can specify the total number of images for the resulting device, or you can specify how many images to add to the device. You can also optionally specify on which physical volumes the new metadata/data image pairs will reside.
Metadata subvolumes (named *_rmeta_*) always exist on the same physical devices as their data subvolume counterparts *_rimage_*). The metadata/data subvolume pairs will not be created on the same physical volumes as those from another metadata/data subvolume pair in the RAID array (unless you specify --alloc anywhere).
The format for the command to add images to a RAID1 volume is as follows:
lvconvert -m new_absolute_count vg/lv [removable_PVs]
lvconvert -m +num_additional_images vg/lv [removable_PVs]
For example, the following display shows the LVM device my_vg/my_lv which is a 2-way RAID1 array:
# lvs -a -o name,copy_percent,devices my_vg
  LV            Copy%  Devices                      
  my_lv                 6.25 my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sde1(0)                 
  [my_lv_rimage_1]        /dev/sdf1(1)                 
  [my_lv_rmeta_0]         /dev/sde1(256)               
  [my_lv_rmeta_1]         /dev/sdf1(0)
The following command converts the 2-way RAID1 device my_vg/my_lv to a 3-way RAID1 device:
# lvconvert -m 2 my_vg/my_lv
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                                     
  my_lv              6.25 my_lv_rimage_0(0),my_lv_rimage_1(0),my_lv_rimage_2(0)
  [my_lv_rimage_0]        /dev/sde1(0)                                
  [my_lv_rimage_1]        /dev/sdf1(1)                                
  [my_lv_rimage_2]        /dev/sdg1(1)                                
  [my_lv_rmeta_0]         /dev/sde1(256)                              
  [my_lv_rmeta_1]         /dev/sdf1(0)                                
  [my_lv_rmeta_2]         /dev/sdg1(0)
When you add an image to a RAID1 array, you can specify which physical volumes to use for the image. The following command converts the 2-way RAID1 device my_vg/my_lv to a 3-way RAID1 device, specifying that the physical volume /dev/sdd1 be used for the array:
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices
  my_lv             56.00 my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sda1(1)
  [my_lv_rimage_1]        /dev/sdb1(1)
  [my_lv_rmeta_0]         /dev/sda1(0)
  [my_lv_rmeta_1]         /dev/sdb1(0)
# lvconvert -m 2 my_vg/my_lv /dev/sdd1
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices
  my_lv             28.00 my_lv_rimage_0(0),my_lv_rimage_1(0),my_lv_rimage_2(0)
  [my_lv_rimage_0]        /dev/sda1(1)
  [my_lv_rimage_1]        /dev/sdb1(1)
  [my_lv_rimage_2]        /dev/sdd1(1)
  [my_lv_rmeta_0]         /dev/sda1(0)
  [my_lv_rmeta_1]         /dev/sdb1(0)
  [my_lv_rmeta_2]         /dev/sdd1(0)
To remove images from a RAID1 array, use the following command. When you remove images from a RAID1 device with the lvconvert command, you can specify the total number of images for the resulting device, or you can specify how many images to remove from the device. You can also optionally specify the physical volumes from which to remove the device.
lvconvert -m new_absolute_count vg/lv [removable_PVs]
lvconvert -m -num_fewer_images vg/lv [removable_PVs]
Additionally, when an image and its associated metadata subvolume volume are removed, any higher-numbered images will be shifted down to fill the slot. If you remove lv_rimage_1 from a 3-way RAID1 array that consists of lv_rimage_0, lv_rimage_1, and lv_rimage_2, this results in a RAID1 array that consists of lv_rimage_0 and lv_rimage_1. The subvolume lv_rimage_2 will be renamed and take over the empty slot, becoming lv_rimage_1.
The following example shows the layout of a 3-way RAID1 logical volume my_vg/my_lv.
# 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_2(0)
  [my_lv_rimage_0]        /dev/sde1(1)                                
  [my_lv_rimage_1]        /dev/sdf1(1)                                
  [my_lv_rimage_2]        /dev/sdg1(1)                                
  [my_lv_rmeta_0]         /dev/sde1(0)                                
  [my_lv_rmeta_1]         /dev/sdf1(0)                                
  [my_lv_rmeta_2]         /dev/sdg1(0)
The following command converts the 3-way RAID1 logical volume into a 2-way RAID1 logical volume.
# lvconvert -m1 my_vg/my_lv
# 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(1)                 
  [my_lv_rimage_1]        /dev/sdf1(1)                 
  [my_lv_rmeta_0]         /dev/sde1(0)                 
  [my_lv_rmeta_1]         /dev/sdf1(0)
The following command converts the 3-way RAID1 logical volume into a 2-way RAID1 logical volume, specifying the physical volume that contains the image to remove as /dev/sde1.
# lvconvert -m1 my_vg/my_lv /dev/sde1
# 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/sdf1(1)                 
  [my_lv_rimage_1]        /dev/sdg1(1)                 
  [my_lv_rmeta_0]         /dev/sdf1(0)                 
  [my_lv_rmeta_1]         /dev/sdg1(0)
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.