$linuxjunkies
>

vgcreate(8)

Create a new LVM volume group from one or more physical volumes.

UbuntuDebianFedoraArch

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

FlagWhat it does
-s, --physicalextentsize SIZESet the physical extent size in MB (default 4); must be a power of 2 between 1 and 16384
-l, --maxlogicalvolumes MAXSet the maximum number of logical volumes this VG can contain
-p, --maxphysicalvolumes MAXSet the maximum number of physical volumes this VG can contain
-f, --forceForce creation without user confirmation; useful in scripts
-A, --autobackup y|nAutomatically back up metadata changes to /etc/lvm/backup (default: yes)
--dataalignment SIZESet data alignment in MB for physical volumes; recommended for optimal performance on SSDs
-M, --metadatatype lvm2|lvm1Specify metadata format; lvm2 is the modern standard (default: lvm2)
-v, --verboseProvide 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/sdb1

Create a volume group from three physical volumes to pool their capacity together

vgcreate vg_storage /dev/sdc1 /dev/sdd1 /dev/sde1

Create a volume group with 8 MB physical extents for larger logical volumes

vgcreate -s 8 vg_large /dev/sdb1

Create a volume group on an SSD with 1024 MB data alignment for optimal performance

vgcreate --dataalignment 1024 vg_ssd /dev/nvme0n1p1

Create a volume group limited to 20 logical volumes and 5 physical volumes maximum

vgcreate -l 20 -p 5 vg_test /dev/sdb1

Create a volume group with verbose output showing each step of the process

vgcreate -v vg_backup /dev/sdc1

Related commands