CentOS / RHEL : Move a Physical Volume from an existing Volume Group to another Volume Group

This post describes how to move a Physical Volume from an existing Volume Group to another existing Volume Group. This facilitates the move of data in the PV to the new VG without doing any manual migration.

Before moving a PV, you should make sure that the Logical Volumes created on top of such PVs does not share physical extents with other PVs. You can find the extent and device of an LV using the command given below;
# lvdisplay -m

Steps involved

1. Unmount the directory .

# umount /data01

2. Deactivate the active LVs on the device.

# lvchange -a n /dev/data_vg/lv_data01

3. Split the VG to a new temp VG and rescan the PVs

# vgsplit data_vg tempvg PV
# pvscan

The pvscan command will list the available PVs and their VGs.

4. Merge the tempvg to the destination VG

# vgmerge dest_vg tempvg
# pvscan

5. After everything is listed correctly in the pvscan command, activate the LVs.

# lvscan
# lvchange -a n /dev/dest_vg/lv_data01

6. Mount the LVs correctly.

# mount -t [filesystem_type] /device /dir
Related Post