vgcreate command is used to create a new LVM (Logical Volume Manager) volume group. The LVM is a disk management system that allows you to create logical volumes that span multiple physical disks. The
vgcreate command creates a new volume group and assigns physical volumes to it. Once a volume group is created, you can create logical volumes within it.
The basic syntax of the
vgcreate command is as follows:
vgcreate [OPTIONS] VGNAME PV...
VGNAME is the name of the new volume group and
PV... is a space-separated list of one or more physical volumes to include in the volume group.
For example, to create a new volume group named
myvg that includes two physical volumes (
/dev/sdc1), you would run the following command:
vgcreate myvg /dev/sdb1 /dev/sdc1
Once the volume group has been created, you can use the
lvcreate command to create logical volumes within it.
The following table lists the available options for the
||Create a clustered volume group|
||Set the maximum number of physical volumes allowed in the volume group|
||Set the physical extent size for the volume group|
||Display verbose output|
||Fill the first few sectors of each physical volume with zeros|
- If you receive an error message stating that the physical volume is already in use, make sure that it is not already part of another volume group.
- If you receive an error message stating that the volume group already exists, choose a different name for your new volume group.
vgcreatecommand can only be run by the root user or a user with sudo privileges.
- It is recommended that you use a consistent naming convention for your volume groups and physical volumes to make it easier to manage and identify them.
- When creating a new volume group, it is best practice to include multiple physical volumes to ensure redundancy and prevent data loss in case of a hardware failure.