美文网首页Linux Troubleshooting
How to migrate mixed striped+lin

How to migrate mixed striped+lin

作者: yangqing | 来源:发表于2023-12-07 10:12 被阅读0次

环境

  • CentOS 9/8/7/6

问题

在 LV 由多个混合条带类型段组成的情况下,其中一些是线性的,一些是条带的。
例如:

[root@centos-6 ~]# lvs -a -o lv_name,vg_name,lv_attr,lv_layout,lv_size,origin,copy_percent,devices,stripes,seg_count
  LV    VG   Attr       Layout         LSize   Origin Cpy%Sync Devices                                      #Str #Seg
  mixed test -wi-a----- linear,striped 159.97g                 /dev/sdi(0),/dev/sdj(0),/dev/sdk(0)             3    5
  mixed test -wi-a----- linear,striped 159.97g                 /dev/sdh(0)                                     1    5
  mixed test -wi-a----- linear,striped 159.97g                 /dev/sdg(0)                                     1    5
  mixed test -wi-a----- linear,striped 159.97g                 /dev/sdd(0),/dev/sde(0),/dev/sdf(0)             3    5
  mixed test -wi-a----- linear,striped 159.97g                 /dev/sdi(5035),/dev/sdj(5035),/dev/sdk(5035)    3    5

以上 LV 是由 5 个段组成的。两个是线性的(条带计数 = 1),另外 3 个段在设备上条带化,起始物理范围位于偏移 0 处/dev/sdi,/dev/sdj ,/dev/sdk和设备/dev/sdd,/dev/sde ,/dev/sdf 。最后一段位于设备上/dev/sdi,/dev/sdj ,/dev/sdk起始物理范围偏移量为 5035。

卷组 (VG) 没有任何可用空间。

[root@centos-6 ~]# vgs
  VG   #PV #LV #SN Attr   VSize   VFree
  test   8   1   0 wz--n- 159.97g    0 

解决

要解决此问题,您首先需要将逻辑卷 (LV) 的大小分配给同一个 VG。

[root@centos-6 ~]# vgs
  VG   #PV #LV #SN Attr   VSize   VFree
  test   8   1   0 wz--n- 159.97g    0 
[root@centos-6 ~]# vgextend test /dev/sdb /dev/sda /dev/sdc 
  Volume group "test" successfully extended
[root@centos-6 ~]# vgs
  VG   #PV #LV #SN Attr   VSize   VFree  
  test  11   1   0 wz--n- 319.96g 159.99g

现在,您可以使用 corelog(在内存中)创建从原始 PV 到新分配的 PV 的镜像。这可以通过 ctrl-c 中断,同步将在后台继续。请务必等到同步完成后再继续下一步。

CentOS 6

[root@centos-6 ~]# lvconvert -m 1 --corelog test/mixed /dev/sda /dev/sdb /dev/sdc
  test/mixed: Converted: 0.0%
  test/mixed: Converted: 1.6%
  test/mixed: Converted: 3.1%
  test/mixed: Converted: 4.6%
 ^C
[root@centos-6 ~]# lvs -a -o lv_name,vg_name,lv_attr,lv_layout,lv_size,origin,copy_percent,devices,stripes,seg_count
  LV               VG   Attr       Layout         LSize   Origin Cpy%Sync Devices                                      #Str #Seg
  mixed            test mwi-a-m--- mirror         159.97g        100.00   mixed_mimage_0(0),mixed_mimage_1(0)             2    1
  [mixed_mimage_0] test iwi-aom--- linear,striped 159.97g                 /dev/sdi(0),/dev/sdj(0),/dev/sdk(0)             3    5
  [mixed_mimage_0] test iwi-aom--- linear,striped 159.97g                 /dev/sdh(0)                                     1    5
  [mixed_mimage_0] test iwi-aom--- linear,striped 159.97g                 /dev/sdg(0)                                     1    5
  [mixed_mimage_0] test iwi-aom--- linear,striped 159.97g                 /dev/sdd(0),/dev/sde(0),/dev/sdf(0)             3    5
  [mixed_mimage_0] test iwi-aom--- linear,striped 159.97g                 /dev/sdi(5035),/dev/sdj(5035),/dev/sdk(5035)    3    5
  [mixed_mimage_1] test iwi-aom--- linear         159.97g                 /dev/sdb(0)                                     1    3
  [mixed_mimage_1] test iwi-aom--- linear         159.97g                 /dev/sda(0)                                     1    3
  [mixed_mimage_1] test iwi-aom--- linear         159.97g                 /dev/sdc(0)                                     1    3

CentOS 7,8,9

[root@centos-9 ~]# lvconvert --type mirror  -m 1 --corelog test/mixed /dev/sd[i-o]
  test/mixed: Converted: 0.0%
  test/mixed: Converted: 1.6%
  test/mixed: Converted: 3.1%
  test/mixed: Converted: 4.6%
 ^C
[root@centos-9 ~]# lvs -a -o lv_name,vg_name,lv_attr,lv_layout,lv_size,origin,copy_percent,devices,stripes,seg_count test
  LV               VG   Attr       Layout         LSize   Origin Cpy%Sync Devices                             #Str #Seg
  mixed            test mwi-a-m--- mirror         699.97g        100.00   mixed_mimage_0(0),mixed_mimage_1(0)    2    1
  [mixed_mimage_0] test Iwi-aom--- linear,striped 699.97g                 /dev/sda(0),/dev/sdb(0),/dev/sdc(0)    3    4
  [mixed_mimage_0] test Iwi-aom--- linear,striped 699.97g                 /dev/sdd(0)                            1    4
  [mixed_mimage_0] test Iwi-aom--- linear,striped 699.97g                 /dev/sde(0),/dev/sdf(0)                2    4
  [mixed_mimage_0] test Iwi-aom--- linear,striped 699.97g                 /dev/sdh(0)                            1    4
  [mixed_mimage_1] test Iwi-aom--- linear         699.97g                 /dev/sdi(0)                            1    7
  [mixed_mimage_1] test Iwi-aom--- linear         699.97g                 /dev/sdj(0)                            1    7
  [mixed_mimage_1] test Iwi-aom--- linear         699.97g                 /dev/sdk(0)                            1    7
  [mixed_mimage_1] test Iwi-aom--- linear         699.97g                 /dev/sdl(0)                            1    7
  [mixed_mimage_1] test Iwi-aom--- linear         699.97g                 /dev/sdm(0)                            1    7
  [mixed_mimage_1] test Iwi-aom--- linear         699.97g                 /dev/sdn(0)                            1    7
  [mixed_mimage_1] test Iwi-aom--- linear         699.97g                 /dev/sdo(0)                            1    7

一旦设备完全同步。您可以从镜子上取下原腿,只留下 线性装置。为此,您需要指定应从镜像中删除哪些 PV。

[root@centos-6 ~]# lvconvert -m 0  test/mixed /dev/sd[d-k]
  Logical volume mixed converted.
[root@centos-6 ~]# lvs -a -o lv_name,vg_name,lv_attr,lv_layout,lv_size,origin,copy_percent,devices,stripes,seg_count
  LV    VG   Attr       Layout     LSize   Origin Cpy%Sync Devices     #Str #Seg
  mixed test -wi-a----- linear     159.97g                 /dev/sdb(0)    1    3
  mixed test -wi-a----- linear     159.97g                 /dev/sda(0)    1    3
  mixed test -wi-a----- linear     159.97g                 /dev/sdc(0)    1    3

CentOS 7,8,9

[root@centos-9 ~]# lvconvert --type mirror -m 0 test/mixed /dev/sd{a,b,c,d,e,f,h}
[root@centos-9 ~]# lvs -a -o lv_name,vg_name,lv_attr,lv_layout,lv_size,origin,copy_percent,devices,stripes,seg_count test
  LV    VG   Attr       Layout     LSize   Origin Cpy%Sync Devices     #Str #Seg
  mixed test -wi-a----- linear     699.97g                 /dev/sdi(0)    1    7
  mixed test -wi-a----- linear     699.97g                 /dev/sdj(0)    1    7
  mixed test -wi-a----- linear     699.97g                 /dev/sdk(0)    1    7
  mixed test -wi-a----- linear     699.97g                 /dev/sdl(0)    1    7
  mixed test -wi-a----- linear     699.97g                 /dev/sdm(0)    1    7
  mixed test -wi-a----- linear     699.97g                 /dev/sdn(0)    1    7
  mixed test -wi-a----- linear     699.97g                 /dev/sdo(0)    1    7

诊断步骤

[root@centos-6 ~]# lvs -a -o lv_name,vg_name,lv_attr,lv_layout,lv_size,origin,copy_percent,devices,stripes,seg_count
  LV    VG   Attr       Layout         LSize   Origin Cpy%Sync Devices                                      #Str #Seg
  mixed test -wi-a----- linear,striped 159.97g                 /dev/sdi(0),/dev/sdj(0),/dev/sdk(0)             3    5
  mixed test -wi-a----- linear,striped 159.97g                 /dev/sdh(0)                                     1    5
  mixed test -wi-a----- linear,striped 159.97g                 /dev/sdg(0)                                     1    5
  mixed test -wi-a----- linear,striped 159.97g                 /dev/sdd(0),/dev/sde(0),/dev/sdf(0)             3    5
  mixed test -wi-a----- linear,striped 159.97g                 /dev/sdi(5035),/dev/sdj(5035),/dev/sdk(5035)    3    5

相关文章

网友评论

    本文标题:How to migrate mixed striped+lin

    本文链接:https://www.haomeiwen.com/subject/psesgdtx.html