Linux LVM: move free space from a volume group to another

Solution 1:

Since you can only move an entire PV from one VG to another, it is not going to be possible to move all free space from one VG to the other. But you can get there part of the way:

First, move all data on one of your PVs to some other PV:

pvmove -v /dev/sdb1

This will start moving the data to the other PVs, away from sdb1. The -v option will also ensure that you see some progress information. Once the move has finished, you can remove it from the volume group:

vgreduce -a

This will report something along the lines of removing /dev/sdb1 from volgroup1 (sorry, it's been a while, and I don't have a machine to test on). You can then add that to the other VG:

vgextend volgroup2 /dev/sdb1

After that, volgroup2 should have the space on sdb1 added to it.

You may be able to repeat this operation with sde1; depends on the amount of free space left in volgroup1 after the first move (I'm too lazy to make the necessary calculations ;-). I would also recommend moving all your data into a single volume group; however, doing that will require you to create a new LV in volgroup2, create a filesystem on it, mount it, use rsync or similar to move the date over, and then destroy the old one. Clearly, this is a more risky operation.