Migrate a Volume Group to a new physical volume on Centos 7

I bought a new set of disk for my HP Microserver Gen10, 2x 10Tb WD HDD, after setting them in RAID 1, I had the necessity migrate the currently running Virtual Machines without creating downtimes, loosing data and of course not waste much time to perform this migration.

Lucky for me I have setup the Microserver Gen10 with LVM this will simplify a lot the procedure that I gonna explain to you below.

First of all I have initialized the physical volume with the command:

pvcreate /dev/sdc

After this I have extended my logical volume called “vms” with vgexent command:

vgextend vms /dev/sdc

After that I started the migration of all Logical Volume from physical volume /dev/sdb to the new physical volume /dev/sdc:

pvmove -b /dev/sdb /dev/sdc

I started then to monitor the progress of the migration with:

progress lvs -a -o+devices

When migration finished I removed the disk from the volume group and then removed the LVM signature from the disk:

vgreduce vms /dev/sdb
pvremove /dev/sdb

That’s it! Now you can remove the HDD/HDDs from the system, hope this guide have helped you.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.