Installation guide

Adding Physical Volumes to a Volume Group
27
You create volume groups in a cluster environment with the vgcreate command, just as you create
them on a single node.
By default, volume groups created with CLVM on shared storage are visible to all computers that have
access to the shared storage. It is possible, however, to create volume groups that are local, visible
only to one node in the cluster, by using the -c n of the vgcreate command.
The following command, when executed in a cluster environment, creates a volume group that is local
to the node from which the command was executed. The command creates a local volume named
vg1 that contains physical volumes /dev/sdd1 and /dev/sde1.
# vgcreate -c n vg1 /dev/sdd1 /dev/sde1
You can change whether an existing volume group is local or clustered with the -c option of the
vgchange command, which is described in Section 4.3.7, “Changing the Parameters of a Volume
Group”.
You can check whether an existing volume group is a clustered volume group with the vgs command,
which displays the c attribute if the volume is clustered. The following command displays the attributes
of the volume groups VolGroup00 and testvg1. In this example, VolGroup00 is not clustered,
while testvg1 is clustered, as indicated by the c attribute under the Attr heading.
[root@doc-07]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup00 1 2 0 wz--n- 19.88G 0
testvg1 1 1 0 wz--nc 46.00G 8.00M
For more information on the vgs command, see Section 4.3.4, “Displaying Volume
Groups”Section 4.8, “Customized Reporting for LVM”, and the vgs man page.
4.3.3. Adding Physical Volumes to a Volume Group
To add additional physical volumes to an existing volume group, use the vgextend command. The
vgextend command increases a volume group's capacity by adding one or more free physical
volumes.
The following command adds the physical volume /dev/sdf1 to the volume group vg1.
# vgextend vg1 /dev/sdf1
4.3.4. Displaying Volume Groups
There are two commands you can use to display properties of LVM volume groups: vgs and
vgdisplay.
The vgscan command, which scans all the disks for volume groups and rebuilds the LVM cache
file, also displays the volume groups. For information on the vgscan command, see Section 4.3.5,
“Scanning Disks for Volume Groups to Build the Cache File”.
The vgs command provides volume group information in a configurable form, displaying one line per
volume group. The vgs command provides a great deal of format control, and is useful for scripting.