4.3. Volume Group Administration
This section describes the commands that perform the various aspects of volume group administration.
4.3.1. Creating Volume Groups
To create a volume group from one or more physical volumes, use the
vgcreatecommand creates a new volume group by name and adds at least one physical volume to it.
The following command creates a volume group named
vg1that contains physical volumes
vgcreate vg1 /dev/sdd1 /dev/sde1
When physical volumes are used to create a volume group, its disk space is divided into 4MB extents, by default. This extent is the minimum amount by which the logical volume may be increased or decreased in size. Large numbers of extents will have no impact on I/O performance of the logical volume.
You can specify the extent size with the
-soption to the
vgcreatecommand if the default extent size is not suitable. You can put limits on the number of physical or logical volumes the volume group can have by using the
-larguments of the
By default, a volume group allocates physical extents according to common-sense rules such as not placing parallel stripes on the same physical volume. This is the
normalallocation policy. You can use the
--allocargument of the
vgcreatecommand to specify an allocation policy of
contiguouspolicy requires that new extents are adjacent to existing extents. If there are sufficient free extents to satisfy an allocation request but a
normalallocation policy would not use them, the
anywhereallocation policy will, even if that reduces performance by placing two stripes on the same physical volume. The
clingpolicy places new extents on the same physical volume as existing extents in the same stripe of the logical volume. These policies can be changed using the
In general, allocation policies other than
normalare required only in special cases where you need to specify unusual or nonstandard extent allocation.
LVM volume groups and underlying logical volumes are included in the device special file directory tree in the
/devdirectory with the following layout:
For example, if you create two volume groups
myvg2, each with three logical volumes named
lvo3, this create six device special files:
/dev/myvg1/lv01 /dev/myvg1/lv02 /dev/myvg1/lv03 /dev/myvg2/lv01 /dev/myvg2/lv02 /dev/myvg2/lv03
The maximum device size with LVM is 8 Exabytes on 64-bit CPUs.