3.4. Splitting a LVM volume group
If there is enough unused space on the physical volumes, a new volume group can be created without adding new disks.
In the initial setup, the volume group myvg consists of /dev/vdb1, /dev/vdb2, and /dev/vdb3. After completing this procedure, the volume group myvg will consist of /dev/vdb1 and /dev/vdb2, and the second volume group, yourvg, will consist of /dev/vdb3.
Conditions préalables
-
You have sufficient space in the volume group. Use the
vgscancommand to determine how much free space is currently available in the volume group. -
Depending on the free capacity in the existing physical volume, move all the used physical extents to other physical volume using the
pvmovecommand. For more information, see Removing physical volumes from a volume group.
Procédure
Split the existing volume group myvg to the new volume group yourvg:
vgsplit myvg yourvg /dev/vdb3
# vgsplit myvg yourvg /dev/vdb3 Volume group "yourvg" successfully split from "myvg"Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIf you have created a logical volume using the existing volume group, use the following command to deactivate the logical volume:
lvchange -a n /dev/myvg/mylv
# lvchange -a n /dev/myvg/mylvCopy to Clipboard Copied! Toggle word wrap Toggle overflow For more information on creating logical volumes, see Managing LVM logical volumes.
View the attributes of the two volume group:
vgs
# vgs VG #PV #LV #SN Attr VSize VFree myvg 2 1 0 wz--n- 34.30G 10.80G yourvg 1 0 0 wz--n- 17.15G 17.15GCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Vérification
Verify if the newly created volume group yourvg consists of /dev/vdb3 physical volume:
pvs
# pvs PV VG Fmt Attr PSize PFree Used /dev/vdb1 myvg lvm2 a-- 1020.00m 0 1020.00m /dev/vdb2 myvg lvm2 a-- 1020.00m 0 1020.00m /dev/vdb3 yourvg lvm2 a-- 1020.00m 1008.00m 12.00mCopy to Clipboard Copied! Toggle word wrap Toggle overflow