-   Linux - Newbie (
-   -   LVM - I added a new partition to the WRONG Volgroup (

jgonzales6266 06-07-2012 03:29 PM

LVM - I added a new partition to the WRONG Volgroup
RHEL 5.5 / LVM2
I created a new partition /dev/sdb2 and added it to the wrong VolGroup. It isn't being used; I stopped as soon as I did it! How can I remove it and add it to the correct group?

The group it is in now is VolGroup00 and has the root file system in it...

Thank you!

I was able to remove the partition using the LVM GUI. I would still love to get the correct procedure for CLI.

tommylovell 06-07-2012 05:57 PM

If it's empty it's just two commands (as root, of course)

vgreduce VolGroup00 /dev/sdb2

pvremove /dev/sdb2
If it was in use, it's no big deal. You'd just have an extra step of pvmove'ing the data off of that PV before doing the above.

That would be

pvmove /dev/sdb2 /dev/<dest-volume>
There is a bug in LVM (per Red Hat) where it can hang using the above command IF there are multiple LV's on the PV.
It doesn't always hang, but to be on the safe side in that case you could move each LV individually.

List what is on the PV first.

pvdisplay --maps /dev/sdb2

pvmove -n <LV name> /dev/sdb2 /dev/<dest-volume>
for each Logical Volume.

All times are GMT -5. The time now is 07:02 AM.