[linux-lvm] shift PV from disk to raid device?

Kai Schaetzl maillists at conactive.com
Tue Dec 9 19:42:54 UTC 2008

Stuart D. Gathman wrote on Tue, 9 Dec 2008 13:38:46 -0500 (EST):

> 1) create md2 from sda3 and sdb3
> 2) pvcreate md2
> 3) add sda3 to VG - LVM complains about dup and uses sdb3 instead

A bit different. But thanks for this hint. I checked my bash history now. 
Short summary:

mdadm --create --verbose /dev/md3 --level=1 --raid-devices=2 /dev/sda3 missing
mdadm --detail /dev/md3
pvcreate /dev/md3
pvcreate /dev/md3 -ff
vgcreate dom1 /dev/md3 (to avoid name clash with dom0 on sdb3)
.. some lvcreate and other stuff
mdadm --detail /dev/md3
vgchange dom1 -an

vgrename dom1 dom0

vgchange dom0 -ay
mdadm /dev/md3 -a /dev/sdb3

So, I did it all alright. I was wrong with my assumption about using the wrong 
device for the PV. However, I only notice now that /dev/md3 is gone for good, 
mdadm cannot find it. I had not been paying attention and thought that md2 was 
the array in question. (Thinking md0=sda1/sdb1, md1=sda2/sdb2, md2=sda3/sdb3, but 
I used md0=sda1/sdb1, md2=sda2/sdb2, md3=sda3/sdb3). So I didn't notice it.

Going further back in the history, it seems I forgot to pvremove the earlier 
existing PV /dev/sda3 (which had the same structure and data) before creating the 
PV on /dev/md3. That's why I had to -ff /dev/md3 I assume. It seems that after 
adding sdb3 to the array and rebooting the array dissolved completely and the 
existing PVs on sda3 and sdb3 came back into existence. And I thought it was an 
effect of the mirror sync.

So, I think I will just start over by removing /dev/sda3 now completely,
recreating the raid array and then recreating the PV on it. I think I should then 
be able to pvmove the LVs from /dev/sdb3 to /dev/md3, right? Problem solved. This 

However, as this is the second time that this or a similar array just vanishes I 
wonder if there's something else going on. e.g. some kind of unwanted interaction 
between LVM and mdraid partitions. The other two raid arrays on the disk are 
absolutely stable and don't use LVM.


Kai Schätzl, Berlin, Germany
Get your web at Conactive Internet Services: http://www.conactive.co

More information about the linux-lvm mailing list