(note, this is a re-send due to accidentally removing the mailing list from the 
recipient list)

On Thu, Mar 13, 2025, at 20:27, Zdenek Kabelac wrote:
> Dne 14. 03. 25 v 1:17 Patrick Hemmer napsal(a):
>> 
>> On Thu, Mar 13, 2025, at 20:05, Zdenek Kabelac wrote:
>>> Dne 14. 03. 25 v 0:14 Patrick Hemmer napsal(a):
>>>> On Thu, Mar 13, 2025, at 14:54, Zdenek Kabelac wrote:
>>>>> Dne 13. 03. 25 v 1:38 Patrick Hemmer napsal(a):
>>>>>> I've got a LVM thin stripe volume across 2 drives that I'm trying to 
>>>>>> migrate to a new larger single drive (getting rid of the old drives). 
>>>>>> Following various information on the subject, it seems the procedure 
>>>>>> here is to first convert from stripe to mirror, and then from mirror to 
>>>>>> linear. While attempting this, I seem to have hit an issue on the second 
>>>>>> part of that process, and am not having much luck resolving it.
>>>>>
>>>>> Hi
>>>>>
>>>>> Likely you can convert your nearly full thin-pool with a single thin 
>>>>> volume to
>>>>> a linear  LV by just taking  'dd' copy of  if=/dev/thin of=/dev/linear - 
>>>>> using
>>>>> direct io option (and this can be actually faster then raid mirroring).
>>>>
>>>> I assume I need to copy both the tdata and tmeta volumes to their new 
>>>> linear counterparts. Did this, but now I assume I need to do something to 
>>>> get lvm to rescan the new linear thin volume to pick up the logical 
>>>> volumes that are now on it. And also stop LVM from picking them up off the 
>>>> old thin volume. I deactivated the old thin volume, but LVM is still 
>>>> recognizing up all the logical volumes inside it. I could completely 
>>>> delete the old thin volume, but I'd prefer to get the new volume online 
>>>> before doing that.
>>>>
>>>
>>> Hi
>>>
>>> Thin volume is using thin pool that is using data & metadata.
>>>
>>> Thus thin-pool can remain active even when thin LV is already deactivated,
>>> depends on the use case - and you can obviously deactivate also your 
>>> thin-pool.
>>>
>>> In your case you need to 'forget' copying thin_tdata or thin_tmeta or even
>>> thin-pool ssd/thin itself.
>>> Your 'lvs -a'  you've shown unfortunately  lists *ONLY* thin-pool  
>>> (ssd/thin)
>>> but not a single thin LV  (with letter 'V' in attributes and using 
>>> 'ssd/thin'
>>> as Poll volume)
>>>
>> Yes, I mentioned a couple times in the first email that there are many 
>> volumes which sit on top of the thin volume, but which I omitted. And that I 
>> did not want to copy them manually, because there's a lot of them, and many 
>> of them are snapshots. So to recreate the snapshots, I'd have to copy the 
>> oldest snapshot to the new thin volume, snapshot it, copy the next oldest, 
>> etc down the line. That would be a very time consuming and painful process. 
>> Hence why it's not under consideration.
>
>
> Then you are using somewhat  confusing terminology.
>
> If you want to convert  thin  to linear - it means you no longer want it 
> would 
> a thin volume.

No, that's not how it works. "thin" and "linear" aren't exclusive, and aren't 
even related. "thin" vs "thick" is the method of allocation and has nothing to 
do with disk layout, or the distribution of extents on the devices, which is 
what "linear" vs "striped" refers to.

This can be demonstrated in the following output:
# lvs -o+lv_layout,stripes -a
  LV                                     VG   Attr       LSize   Pool Origin    
                    Data%  Meta%  Move Log Cpy%Sync Convert Layout      #Str
  thin                                   ssd  twi-aotz-- 930.59g                
                    92.40  98.76                            thin,pool      1
  [thin_tdata]                           ssd  Twi-ao---- 930.59g                
                                                            striped        2
  [thin_tmeta]                           ssd  ewi-ao---- 236.00m                
                                                            linear         1

^ Note how the thin_tdata is striped.

Now here's another thin volume I just created:
# lvs -o+lv_layout,stripes -a
  LV                                     VG   Attr       LSize    Pool Origin   
                     Data%  Meta%  Move Log Cpy%Sync Convert Layout      #Str
  test                                   ssd  twi-a-tz--    1.00g               
                     0.00   10.94                            thin,pool      1
  [test_tdata]                           ssd  Twi-ao----    1.00g               
                                                             linear         1
  [test_tmeta]                           ssd  ewi-ao----    4.00m               
                                                             linear         1
                                            
^ Note how test_tdata is linear.

> For this you need to copy 'dd'  thins you want to convert - and obviously if 
> you had 300G thinLV + 300G snapshot thinLV -  you need  600G to store them in 
> linear volumes.
>
> If you want to something different you will need to desribe things 
> differently.

I'm describing exactly what I want. To convert a thin striped volume to linear.

> Buf if you do not want to use thin-pool with your new storage - then use 'dd' 
> copy
>
> If you want to however just 'migrage' thin-pool to a new PV  - then you can 
> simply  'vgextend'  new drive to your existing VG.
> Then  pvmove  /dev/old  /dev/new

No, this does not work because of the striping. You cannot move extents from 
two different physical drives onto a single physical drive without first 
disabling the striping. To disable the striping, you have to convert to linear. 
If you try to migrate the extents without disabling striping, LVM refuses to do 
so because it violates the policy (the logical volume is no longer "striped"):
# pvmove /dev/sdb /dev/sda
  Insufficient suitable allocatable extents for logical volume : 119116 more 
required
  Unable to allocate mirror extents for ssd/pvmove0.
  Failed to convert pvmove LV to mirrored.

And no, it's not complaining because sda doesn't have enough space. It's 
complaining because of suitable *allocatable* extents. It can't allocate them 
on that drive because doing so violates the striping policy.

RedHat has documentation on this subject, and which is the documentation I was 
following. https://access.redhat.com/solutions/368783

> lvm2 will figure out how to do a mirroring.
> Once this all is finished you simply 'vgreduce' your old PV from this VG.
>
> Regards
>
> Zdenek

--
Patrick


Reply via email to