Re: Duplicate pv, vg, lv after copying disk

Dominic Raferd <[email protected]> Thu, 3 Apr 2025 06:59:12 +0100
Newsgroups gmane.linux.lvm.general
Message-ID <[email protected]>
On 31/03/2025 13:52, Zdenek Kabelac wrote:
> Dne 30. 03. 25 v 18:28 Dominic Raferd napsal(a):
>> My LVM is working great but lvm utilities show - only, when using -o 
>> devices, that I have multiple copies of the same pv, vg and lvs. See 
>> below, the first invocation is what I would expect (one PV 
>> 'nvme0n1p2', one VG 'vg1', four LVs 'home' 'log' 'rootfs' and 'swap') 
>> but in each case the second invocation (i.e. with -o +devices) shows 
>> multiple versions of the same thing.
>>
>> This may be because I copied my disk to another using clonezilla and 
>> subsequently copied the new disk back to the original using dd. I'm 
>> now only using the original disk. Although I am also seeing (not 
>> shown below) duplicate devices for a 2nd PV and VG and LVs which are 
>> on a second disk on the same machine - and this second disk was 
>> unchanged throughout the process.
>>
>> # pvs|grep -F nvme
>> # lvs -o +devices|grep -F vg1
>>    home   vg1 -wi-ao---- 600.00g /dev/nvme0n1p2(2048)
>>    home   vg1 -wi-ao---- 600.00g /dev/nvme0n1p2(91136)
>>    log    vg1 -wi-ao---- 4.00g /dev/nvme0n1p2(1024)
>>    rootfs vg1 -wi-ao---- 24.00g /dev/nvme0n1p2(78848)
>>    rootfs vg1 -wi-ao---- 24.00g /dev/nvme0n1p2(173056)
>>    swap   vg1 -wc-ao---- 32.00g /dev/nvme0n1p2(82944)
>>
>> As I say, this has not caused a problem so far, but it is certainly 
>> ugly and looks like it might cause problems in the future. Should I 
>> ignore it or any ideas how I can fix it?
>
> When you use '-o+devices' - you are asking for 'segmented' properties 
> of your LV. Every LV is composed for segments i.e. depends on how the 
> allocation engine manage to satisfy allocation request for physical size.
>
> In your case  'roorfs' is composed from 2 segments - one starts @78848 
> extent
> and second @173056 extens -  every extent has 4MiB in size.
>
> You can get more details with  'lvs -o+seg_le_ranges'
> that will show you extent layout and assignment in more details.
>
> If you want to just see a 'single line' per LV - avoid adding 
> 'segmented' properties to your 'lvs -o' command.
>
Ah I did not understand, thank you Zdenek for the explanation, I shall 
stop worrying about it.