Este conteúdo não está disponível no idioma selecionado.
5.3. Splitting a Volume Group
In this example procedure, an existing volume group consists of three physical volumes. If there is enough unused space on the physical volumes, a new volume group can be created without adding new disks.
In the initial set up, the logical volume
mylv
is carved from the volume group myvol
, which in turn consists of the three physical volumes, /dev/sda1
, /dev/sdb1
, and /dev/sdc1
.
After completing this procedure, the volume group
myvg
will consist of /dev/sda1
and /dev/sdb1
. A second volume group, yourvg
, will consist of /dev/sdc1
.
- Use the
pvscan
command to determine how much free space is currently available in the volume group.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Move all the used physical extents in
/dev/sdc1
to/dev/sdb1
with thepvmove
command. Thepvmove
command can take a long time to execute.Copy to Clipboard Copied! Toggle word wrap Toggle overflow After moving the data, you can see that all of the space on/dev/sdc1
is free.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - To create the new volume group
yourvg
, use thevgsplit
command to split the volume groupmyvg
.Before you can split the volume group, the logical volume must be inactive. If the file system is mounted, you must unmount the file system before deactivating the logical volume.Deactivate the logical volumes with thelvchange
command or thevgchange
command. The following command deactivates the logical volumemylv
and then splits the volume groupyourvg
from the volume groupmyvg
, moving the physical volume/dev/sdc1
into the new volume groupyourvg
.lvchange -a n /dev/myvg/mylv vgsplit myvg yourvg /dev/sdc1
# lvchange -a n /dev/myvg/mylv # vgsplit myvg yourvg /dev/sdc1 Volume group "yourvg" successfully split from "myvg"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can use thevgs
command to see the attributes of the two volume groups.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.15G
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - After creating the new volume group, create the new logical volume
yourlv
.lvcreate -L 5G -n yourlv yourvg
# lvcreate -L 5G -n yourlv yourvg Logical volume "yourlv" created
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a file system on the new logical volume and mount it.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Since you had to deactivate the logical volume
mylv
, you need to activate it again before you can mount it.Copy to Clipboard Copied! Toggle word wrap Toggle overflow