Linux LVM migration

So, you have setup a nice lvm partitioning scheme to future proof life, maybe the system will have a heart attack and need a new mobo; maybe we will fill up 20TB within the next year or so; maybe we get new architecture and want to migrate our huge data store across – ah haa !

So you get the set of lvm drives into the new system, boot up and can see the drives using:

fdisk -l

Great so far so good, now what ?

Well, we dont need to know why, just do this:

pvscan (will search all lvm block devices for physical volumes)

vgscan (scans all disks for volume groups)

If you are here its because you haven’t done this before and therefore have not taken the steps to prepare an lvm migration therefore:

1 – mark the volume group inactive

vgchange -an <volume group name here>

2 – export the volume group

vgexport <volume group>

3 – import the volume group into the system (kernel)

vgimport <volume group>

4 – activate the volume group

vgchange -ay <volume group>

Job done !

You can go ahead and mount as required.

Credited source over here