How to migrate mixed striped+linear LVs to linear only.
Environment
- Red Hat Enterprise Linux 9
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 6
Issue
In situations if a LV consists of multiple mixed stripe type segments, some of them are linear, some are striped.
For example:
[root@rhel-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
Above LV is compund from 5 segments. Two are linear (stripe count=1) other 3 segments are striped on devices with starting physical extent on offset 0 /dev/sdi, /dev/sdj, /dev/sdk and devices /dev/sdd, /dev/sde, /dev/sdf. The last segment is then on devices /dev/sdi, /dev/sdj, /dev/sdk starting physical extent offset is 5035.
The volume group (VG) does not have any free space.
[root@rhel-6 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
test 8 1 0 wz--n- 159.97g 0
Resolution
To resolve the issue first you need to allocate the size of the logical volume (LV) to the same VG.
[root@rhel-6 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
test 8 1 0 wz--n- 159.97g 0
[root@rhel-6 ~]# vgextend test /dev/sdb /dev/sda /dev/sdc
Volume group "test" successfully extended
[root@rhel-6 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
test 11 1 0 wz--n- 319.96g 159.99g
Now you can create mirror from the original PVs to the newly allocated PVs using the corelog (in memory). This can be interrupted by ctrl-c and the synchronization will continue in background. It's important to wait till the synchronization is complete before proceeding with next step.
RHEL 6
[root@rhel-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@rhel-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
RHEL 7,8,9
[root@rhel-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@rhel-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
Once the devices are fully synchronized. You can remove the origan leg from the mirror leaving just the
linear devices. To do so you need to specify which PVs should be removed from the mirror.
[root@rhel-6 ~]# lvconvert -m 0 test/mixed /dev/sd[d-k]
Logical volume mixed converted.
[root@rhel-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
RHEL 7,8,9
[root@rhel-9 ~]# lvconvert --type mirror -m 0 test/mixed /dev/sd{a,b,c,d,e,f,h}
[root@rhel-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
Diagnostic Steps
[root@rhel-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
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments