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

Stuart D. Gathman stuart at bmsi.com
Tue Dec 9 18:38:46 UTC 2008

On Tue, 9 Dec 2008, Kai Schaetzl wrote:

> how could I confirm that? pvs? No, it gives me:
>   Found duplicate PV cs0HTBNIjwhdDD2fd6wvHTzAN61x8aWD: using /dev/sdb3 not 
> /dev/sda3
>   PV         VG   Fmt  Attr PSize   PFree
>   /dev/sdb3  dom0 lvm2 a-   456.34G 350.34G

Yes, there is a problem.  (Keep checking and double checking the procedure
before executing.)  You need to know which device, (sda3, sdb3, md2), LVM is
actually writing to.  

Here is what I think you did:

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

If LVM is current actually using sdb3, then you need to remove *sdb3* from md2,
and pvmove the data to md2 (which will now have only sda3).

Let's try again:

0.5) backup
1) remove the partition LVM is writing to (sdb3) from md2 (otherwise all
   writes to md2 will scribble on both),
2) pvremove md2 (which hopefully does *not* contain the device LVM is
   putting your data on) to erase duplicate metadata (or use dd - maybe
   pvremove gets confused with dups)
3) pvcreate md2 and add to VG
4) pvmove data from sdb3 to md2
5) reduce sdb3 from VG
6) add sdb3 to md2 and sync

	      Stuart D. Gathman <stuart at bmsi.com>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.

More information about the linux-lvm mailing list