vgcreate(8)
Create a new LVM volume group from one or more physical volumes.
Synopsis
vgcreate [OPTION]... VolumeGroupName PhysicalVolumePath [PhysicalVolumePath]...Description
vgcreate initializes a volume group (VG) on one or more physical volumes (PVs) that have been prepared with pvcreate. A volume group pools the storage capacity of physical volumes into logical volumes that can be dynamically resized and managed.
Before running vgcreate, ensure physical volumes are initialized using pvcreate. After creating a volume group, you can allocate logical volumes from it using lvcreate.
The volume group name must be unique on the system and cannot contain certain special characters. Common practice is to use descriptive names like 'vg_data' or 'vg_home'.
Common options
| Flag | What it does |
|---|---|
-s, --physicalextentsize SIZE | Set the physical extent size in MB (default 4); must be a power of 2 between 1 and 16384 |
-l, --maxlogicalvolumes MAX | Set the maximum number of logical volumes this VG can contain |
-p, --maxphysicalvolumes MAX | Set the maximum number of physical volumes this VG can contain |
-f, --force | Force creation without user confirmation; useful in scripts |
-A, --autobackup y|n | Automatically back up metadata changes to /etc/lvm/backup (default: yes) |
--dataalignment SIZE | Set data alignment in MB for physical volumes; recommended for optimal performance on SSDs |
-M, --metadatatype lvm2|lvm1 | Specify metadata format; lvm2 is the modern standard (default: lvm2) |
-v, --verbose | Provide detailed information about the vgcreate process |
Examples
Create a volume group named 'vg_data' using a single physical volume /dev/sdb1
vgcreate vg_data /dev/sdb1Create a volume group from three physical volumes to pool their capacity together
vgcreate vg_storage /dev/sdc1 /dev/sdd1 /dev/sde1Create a volume group with 8 MB physical extents for larger logical volumes
vgcreate -s 8 vg_large /dev/sdb1Create a volume group on an SSD with 1024 MB data alignment for optimal performance
vgcreate --dataalignment 1024 vg_ssd /dev/nvme0n1p1Create a volume group limited to 20 logical volumes and 5 physical volumes maximum
vgcreate -l 20 -p 5 vg_test /dev/sdb1Create a volume group with verbose output showing each step of the process
vgcreate -v vg_backup /dev/sdc1