System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Using LVM mirroring to Migrate to another SAN with dissimilar PVs

SOLVED
Go to solution
dgangemi
Advisor

Using LVM mirroring to Migrate to another SAN with dissimilar PVs

Hello
I very rarely post anything anywhere, so if do anything wrong, I apologize in advance :).

I need to migrate from one mfgr SAN to a different mfgr SAN. The lvols on the VG supported by the old SAN are large, but started small, and have grown by gradual concatenation over time to the point where it's quite a hodgepodge of LUNs of various sizes supporting the lvols.

I Want to use mirroring to do the migration but I want only ONE mirror LUN from the new SAN - then after the mirror is complete, I'll lvreduce the lvol and remove all those small LUNs from the old SAN.

Is this possible, and do you have any reccomendations to go about it?
4 REPLIES
TTr
Honored Contributor

Re: Using LVM mirroring to Migrate to another SAN with dissimilar PVs

Yes it is possible with LVM mirroring. You have to add the PVs from the new SAN to the appropriate VGs and them mirror each LVOL to the new PV using lvextend.

One common problem is that the size of the new PVs is such that they don't "fit" into the existing VGs as far as the number and size of the PEs (Physical extends). Run "vgdisplay" on the VGs and at the top, check the PE size and the max PEs allowed in the VG. That determines the maximum size of a PV that you can add to the VG.

If you have 11.23 or newer you can work with vgmodify to change the max extends in the VG.

If the PV fits in the VG, you can also look into pvmove to move the extends from the old PVs to the new PV. (you asked about this in 2007)
dgangemi
Advisor

Re: Using LVM mirroring to Migrate to another SAN with dissimilar PVs

So for example (leaving aside the VG constraints for the time being)
If you have a VG with say 8 or 9 PVs of various sizes supporting say a dozen LVs and you add a new PV from the new SAN whose size is equal to all of the old SAN's PVs combined; then theoretically, you could mirror all of those LVs onto the one PV???
TTr
Honored Contributor
Solution

Re: Using LVM mirroring to Migrate to another SAN with dissimilar PVs

> ...and you add a new PV from the new SAN whose size is equal to all of the old SAN's PVs combined; then theoretically, you could mirror all of those LVs onto the one PV???

Correct but you can improve on your statement a little bit. The new PV size has to equal to all the old SAN's **LVs** in each VG (not the PVs, you are mirroring the LVs)
Michael Leu
Honored Contributor

Re: Using LVM mirroring to Migrate to another SAN with dissimilar PVs

Had to do this nearly every week because always the wrong storage array was getting full... ;-)

vgextend -g new vgX
vi /etc/lvmpvg # put all old devices into another PV group
vgdisplay -v vgX # check for stderr and if you missed any old PVs
for i in /dev/vgX/lvol*; do lvchange -s g $i; done
for i in /dev/vgX/lvol*; do lvextend -m 1 $i new; done # takes a while
for i in /dev/vgX/lvol*; do lvreduce -m 0 $i ; done
vgreduce /dev/vgX
for i in /dev/vgX/lvol*; do lvchange -s y $i; done
rm /etc/lvmpvg # or edit if you have other PVGs

Sadly lvreduce and vgreduce do not accept PVGs as a argument, so you need provide a list or glob of all old PVs.