Linux LVM – pvmove multiple pv`s into one pv

Recently i stumbled upon a problem where i had to migrate a volume group which had 2 pv`s, in this example /dev/sdb and /dev/sdc, the migration took place from one storage machine to another.

So i added a new disk to the system called /dev/sdd, pvcreated it, vgextended the VG with the new /dev/sdd and now the question that came into mind is how to migrate the PE`s into the new PV.

Its actually too simple under linux with LVM2… all that is needed to be done is:

pvmove /dev/sdb /dev/sdd

and once thats finished

pvmove /dev/sdc /dev/sdd

and thats all, now all the PE`s are at the new PV, both /dev/sdb and /dev/sdc are free so i could vgreduce them out and disconnect the old storage.

The fun part is that its all being done online without any disruptions to the DB working on thos disks.

This entry was posted in Linux. Bookmark the permalink.