Bug 1483530 - lvconvert --type raid1 LV allows --stripes option
Summary: lvconvert --type raid1 LV allows --stripes option
Keywords:
Status: ASSIGNED
Alias: None
Product: LVM and device-mapper
Classification: Community
Component: lvm2
Version: 2.02.172
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: ---
: ---
Assignee: Marian Csontos
QA Contact: cluster-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-08-21 11:06 UTC by Eric Ren
Modified: 2023-12-15 15:57 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-22 09:57:10 UTC
Embargoed:
rule-engine: lvm-technical-solution?
rule-engine: lvm-test-coverage?


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1494135 0 unspecified CLOSED Stripes handling for conversion of mirrored device needs review 2023-12-15 15:58:22 UTC

Internal Links: 1494135

Description Eric Ren 2017-08-21 11:06:35 UTC
Description of problem:

I want to lvconvert an existing linear LV into rai1 LV, and the new leg of raid1 will consist of 2 PVs. I hope the new leg is "striped" type, but I get "linear" type which is not expected, because I assume "striped" has better performance than "linear".

Version-Release number of selected component (if applicable):

localhost:~/raid1-stripe # lvm version
  LVM version:     2.02.172(2) (2017-06-28)
  Library version: 1.03.01 (2017-06-28)
  Driver version:  4.35.0

How reproducible:

Steps to Reproduce:
1. create VG containing 3 PVs: the size of PV1 equals to the sum size of the rest 2 PVs.

# dd if=/dev/zero of=disk1.raw bs=1G count=2
# dd if=/dev/zero of=disk2.raw bs=1G count=1
# dd if=/dev/zero of=disk3.raw bs=1G count=1

# losetup -f disk1.raw
# losetup -f disk2.raw 
# losetup -f disk3.raw

# vgcreate vg1 /dev/loop0 /dev/loop1 /dev/loop2
        Physical volume "/dev/loop0" successfully created.
        Physical volume "/dev/loop1" successfully created.
        Physical volume "/dev/loop2" successfully created.
        Volume group "vg1" successfully created

2. create an existing linear LV

 # lvcreate -L1.5G -n lv1 vg1 /dev/loop0
        Logical volume "lv1" created.

3. lvconvert lv1 into raid1

# lvconvert --type raid1 -m 1 --stripes 2 vg1/lv1 /dev/loop1 /dev/loop2
Are you sure you want to convert linear LV vg1/lv1 to raid1 with 2 images enhancing resilience? [y/n]: y
        Logical volume vg1/lv1 successfully converted.

4. lvdisplay shows the "lv1_rimage_1" is "linear" type.

# lvs -a
lv1                vg1      rwi-a-r---  1.50g                                              
[lv1_rimage_0]     vg1      iwi-aor---  1.50g                                                    
[lv1_rimage_1]     vg1      Iwi-aor---  1.50g                                                    
[lv1_rmeta_0]      vg1      ewi-aor---  4.00m                                                    
[lv1_rmeta_1]      vg1      ewi-aor---  4.00m

 # lvdisplay -mav vg1/lv1_rimage_1
        --- Logical volume ---
        Internal LV Name       lv1_rimage_1
        VG Name                vg1
        LV UUID                dB3CG1-MXi3-9cBE-kpoa-a4Ul-lpZF-LDIdvI
        LV Write Access        read/write
        LV Creation host, time localhost, 2017-08-21 18:18:24 +0800
        LV Status              available
        # open                 1
        LV Size                1.50 GiB
        Current LE             384
        Segments               2
        Allocation             inherit
        Read ahead sectors     auto
        - currently set to     1024
        Block device           254:12
         
        --- Segments ---
        Logical extents 0 to 253:
          Type                linear
          Physical volume        /dev/loop1
          Physical extents        1 to 254
         
        Logical extents 254 to 383:
          Type                linear
          Physical volume        /dev/loop2
          Physical extents        0 to 129           

Actual results:

The new leg of raid1 is "linear" type.

Expected results:

The new leg of raid1 is "striped" type.

Comment 1 Eric Ren 2017-08-21 11:11:49 UTC
I'm not sure if it's a valid issue. Feel free to close this bug if it's invalid, and I will appreciate if someone can explain it a bit.

Comment 2 Zdenek Kabelac 2017-08-21 13:49:32 UTC
Are you you mistaking  'raid1' with 'raid10' here   if you seek for redundancy & performance.

raid1 is using linears.

raid10 has striped legs.

Comment 3 Eric Ren 2017-08-22 01:37:50 UTC
(In reply to Zdenek Kabelac from comment #2)
> Are you you mistaking  'raid1' with 'raid10' here   if you seek for
> redundancy & performance.
> 
> raid1 is using linears.
> 
> raid10 has striped legs.

Looks like conversion from "linear" to "raid10" is not supported.

# lvremove -f vg1
        Logical volume "lv1" successfully removed
# lvcreate -L1.5G -n lv1 vg1 /dev/loop0
        Logical volume "lv1" created.
# lvconvert --type raid10 -m 1 --stripes 2 vg1/lv1 /dev/loop1 /dev/loop2
        Using default stripesize 64.00 KiB.
        Conversion operation not yet supported.

Comment 4 Eric Ren 2017-08-22 02:41:54 UTC
On the old version, it creates "striped" new leg in such conversion.

===
 # lvm version
  LVM version:     2.02.98(2) (2012-10-15)
  Library version: 1.03.01 (2011-10-15)
  Driver version:  4.25.0

# lvcreate -L1.5G -n lv1 vg1 /dev/loop0
  Logical volume "lv1" created

# lvconvert -m 1 --stripes 2 vg1/lv1 /dev/loop1 /dev/loop2
  Using default stripesize 64.00 KiB
  vg1/lv1: Converted: 0.3%
  vg1/lv1: Converted: 8.3%
  vg1/lv1: Converted: 16.1%
  vg1/lv1: Converted: 24.2%
  vg1/lv1: Converted: 32.0%
  vg1/lv1: Converted: 40.1%
  vg1/lv1: Converted: 47.9%
  vg1/lv1: Converted: 56.0%
  vg1/lv1: Converted: 64.1%
  vg1/lv1: Converted: 71.9%
  vg1/lv1: Converted: 79.2%
  vg1/lv1: Converted: 86.2%
  vg1/lv1: Converted: 93.5%
  vg1/lv1: Converted: 100.0%

# lvdisplay -mav vg1/lv1_mimage_0
    Using logical volume(s) on command line
  --- Logical volume ---
  LV Name                /dev/vg1/lv1_mimage_0
  VG Name                vg1
  LV UUID                dtZefO-bPB4-cERp-3fC3-n1PI-Okcz-51eCYT
  LV Write Access        read/write
  LV Creation host, time b194, 2017-08-22 10:23:40 +0800
  LV Status              available
  # open                 1
  LV Size                1.50 GiB
  Current LE             384
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     1024
  Block device           253:12
   
  --- Segments ---
  Logical extent 0 to 383:
    Type                linear
    Physical volume        /dev/loop0
    Physical extents        0 to 383

# lvdisplay -mav vg1/lv1_mimage_1
  --- Logical volume ---
  LV Name                /dev/vg1/lv1_mimage_1
  VG Name                vg1
  LV UUID                UOFwA4-Az0e-lO8e-VtmM-vUxg-jPEC-s6Kmbc
  LV Write Access        read/write
  LV Creation host, time b194, 2017-08-22 10:23:40 +0800
  LV Status              available
  # open                 1
  LV Size                1.50 GiB
  Current LE             384
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     1024
  Block device           253:13
   
  --- Segments ---
  Logical extent 0 to 383:
    Type                striped
    Stripes                2
    Stripe size                64.00 KiB
    Stripe 0:
      Physical volume        /dev/loop1
      Physical extents        0 to 191
    Stripe 1:
      Physical volume        /dev/loop2
      Physical extents        0 to 191
===

Comment 5 Marian Csontos 2017-08-22 09:29:50 UTC
Old version was using mirror not raid target (using md).

You can still make mirror of stripes with `--type mirror`, but I am not sure though you would gain anything with one leg linear and other stripe...

The combination of -m and -i should be disabled for RAID1.

Comment 6 Eric Ren 2017-08-22 09:57:10 UTC
(In reply to Marian Csontos from comment #5)
> Old version was using mirror not raid target (using md).
> 
> You can still make mirror of stripes with `--type mirror`, but I am not sure
> though you would gain anything with one leg linear and other stripe...
> 
> The combination of -m and -i should be disabled for RAID1.

You're right! The command line blow works for current version:

===
# lvconvert --type mirror -m1 --stripes 2 vg1/lv1 /dev/loop1 /dev/loop2
  Using default stripesize 64.00 KiB.
  vg1/lv1: Converted: 0.0%
  vg1/lv1: Converted: 3.1%
...
  vg1/lv1: Converted: 97.4%
  vg1/lv1: Converted: 100.0%
# lvdisplay -mav vg1/lv1_mimage_1
    Using logical volume(s) on command line.
  --- Logical volume ---
  Internal LV Name       lv1_mimage_1
  VG Name                vg1
  LV UUID                nmHFLQ-WIyk-0f8J-WiqZ-hkZV-AVlX-rOwT4w
  LV Write Access        read/write
  LV Creation host, time linux-nncx, 2017-08-22 17:43:37 +0800
  LV Status              available
  # open                 1
  LV Size                1.50 GiB
  Current LE             384
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     1024
  Block device           254:3
   
  --- Segments ---
  Logical extents 0 to 383:
    Type		striped
    Stripes		2
    Stripe size		64.00 KiB
    Stripe 0:
      Physical volume	/dev/loop1
      Physical extents	0 to 191
    Stripe 1:
      Physical volume	/dev/loop2
      Physical extents	0 to 191
===

Thanks very much for you! I'm closing this.

Comment 7 Marian Csontos 2017-08-22 12:59:10 UTC
Still commands should not simply ignore incompatible options. Patches posted to lvm-devel:

https://www.redhat.com/archives/lvm-devel/2017-August/msg00070.html

Also available on dev-mcsontos-stripes-raid1 branch. Merge please.

Comment 9 Joachim Wagner 2022-03-30 15:29:11 UTC
As of recent version 2.03.15-2.1 (openSUSE Tumbleweed 20220328), `lvconvert` still accepts `--type raid1 --mirrors 1 --stripes 3` and silently produces a linear leg.

Please show an error message and consider keeping support for `--type mirror` to allow manual conversion to striped LV, e.g. as in the accepted answer in https://unix.stackexchange.com/questions/348873/convert-a-single-drive-lvm-volume-to-a-striped-volume-across-3-drives


Note You need to log in before you can comment on or make changes to this bug.