[CentOS] LVM - how to change lv from linear to stripped? Is it possible?

Tue Nov 24 14:42:12 UTC 2015
Rafał Radecki <radecki.rafal at gmail.com>

Hi All.

Currently I am trying to change a logical volume from linear to stripped
because I would like to have a better write throughput. I would like to
perform this change "live" without stopping access to this lv.

I have found two interesting examples:
http://community.hpe.com/t5/System-Administration/Need-to-move-the-data-from-Linear-LV-to-stripped-LV-on-RHEL-5-7/td-p/6134323
http://www.depesz.com/2015/10/08/converting-logical-volume-so-that-its-striped/
Both say basically to:
- change the lv to a mirrored one by adding a stripped copy (~second device
in RAID1)
- change it back to a non-mirrored one by removing the primary linear lv
(~first, source device in RAID1)

My os is:
$ cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
$ uname -r
3.10.0-229.14.1.el7.x86_64
$ rpm -qa | grep -i lvm
lvm2-libs-2.02.115-3.el7_1.1.x86_64
lvm2-2.02.115-3.el7_1.1.x86_64

And the solution proposed in above examples does not work on it.
After (lv xxx is only on /dev/sdb4 before):
# lvconvert --mirrors 1 --stripes 4  /dev/cinder-volumes/xxx /dev/sda4
/dev/sdc4 /dev/sdd4 /dev/sdf4
I am getting in "lvdisplay -m":

--- Logical volume ---
  LV Path                /dev/cinder-volumes/xxx
  LV Name                xxx
  VG Name                cinder-volumes
  LV UUID                AKjKAo-66cv-Ygc2-4Ykq-sSJQ-RJOY-mfjoMD
  LV Write Access        read/write
  LV Creation host, time test.local, 2015-10-28 17:45:28 +0100
  LV Status              available
  # open                 1
  LV Size                64.01 GiB
  Current LE             16386
  Mirrored volumes       2
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:22

  --- Segments ---
  Logical extents 0 to 16385:
    Type                raid1
    Monitoring          monitored
    Raid Data LV 0
      Logical volume    xxx_rimage_0
      Logical extents   0 to 16385
    Raid Data LV 1
      Logical volume    xxx_rimage_1
      Logical extents   0 to 16385
    Raid Metadata LV 0  xxx_rmeta_0
    Raid Metadata LV 1  xxx_rmeta_1

And in "pvdisplay -m":

  --- Physical volume ---
  PV Name               /dev/sda4
  VG Name               cinder-volumes
  PV Size               2.73 TiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              715255
  Free PE               287476
  Allocated PE          427779
  PV UUID               IrkkwI-AqpP-bTll-vlPq-NDSe-rDUg-ecAnkp
...
  Physical extent 427776 to 427776:
    Logical volume      /dev/cinder-volumes/xxx_rmeta_1
    Logical extents     0 to 0
  Physical extent 427777 to 444162:
    Logical volume      /dev/cinder-volumes/xxx_rimage_1
    Logical extents     0 to 16385

  --- Physical volume ---
  PV Name               /dev/sdb4
  VG Name               cinder-volumes
  PV Size               2.73 TiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              715255
  Free PE               698868
  Allocated PE          16387
  PV UUID               hx0a1v-M68S-aPBL-1x9r-8EiD-3cu3-GQPLRo

  --- Physical Segments ---
  Physical extent 0 to 0:
    Logical volume      /dev/cinder-volumes/xxx_rmeta_0
    Logical extents     0 to 0
  Physical extent 1 to 16386:
    Logical volume      /dev/cinder-volumes/xxx_rimage_0
    Logical extents     0 to 16385
  Physical extent 16387 to 715254:
    FREE

So the migration to a RAID1 logical volume is successful but the stripping
(above "lvconvert --mirrors 1 --stripes 4  /dev/cinder-volumes/xxx
/dev/sda4 /dev/sdc4 /dev/sdd4 /dev/sdf4") is not taken into consideration
because only /dev/sda4 and /dev/sdb4 are used for xxx logical volume
afterwards.

Also when I run:

# lvconvert -m 0 /dev/cinder-volumes/xxx /dev/sdb4

afterwards I get xxx logical volume only on /dev/sda4 and it is linear (not
stripped).

Can someone help me with this? ;)

BR,
Rafal.