Linux "vgcreate" Command Line Options and Examples
Create a volume group

vgcreate creates a new VG on block devices. If the devices were not previously intialized as PVs with pvcre‐ ate(8), vgcreate will inititialize them, making them PVs. The pvcreate options for initializing devices are also available with vgcreate.


Usage:

vgcreate position_args
      [ option_args ]






Command Line Options:

--addtag
Adds a tag to a PV, VG or LV. This option can be repeated to add multiple tags at once. See lvm(8) forinformation about tags.
vgcreate --addtag ...
--alloc
Determines the allocation policy when a command needs to allocate Physical Extents (PEs) from the VG.Each VG and LV has an allocation policy which can be changed with vgchange/lvchange, or overriden onthe command line. normal applies common sense rules such as not placing parallel stripes on the samePV. inherit applies the VG policy to an LV. contiguous requires new PEs be placed adjacent to exist‐ing PEs. cling places new PEs on the same PV as existing PEs in the same stripe of the LV. If thereare sufficient PEs for an allocation, but normal does not use them, anywhere will use them even if itreduces performance, e.g. by placing two stripes on the same PV. Optional positional PV args on thecommand line can also be used to limit which PVs the command will use for allocation. See lvm(8) formore information about allocation.
vgcreate --alloc ...
-A|--autobackup
Specifies if metadata should be backed up automatically after a change. Enabling this is stronglyadvised! See vgcfgbackup(8) for more information.
vgcreate -A|--autobackup ...
-c|--clustered
Create a clustered VG using clvmd if LVM is compiled with cluster support. This allows multiple hoststo share a VG on shared devices. clvmd and a lock manager must be configured and running. (A clus‐tered VG using clvmd is different from a shared VG using lvmlockd.) See clvmd(8) for more informationabout clustered VGs.
vgcreate -c|--clustered ...
--commandprofile
The command profile to use for command configuration. See lvm.conf(5) for more information about pro‐files.
vgcreate --commandprofile ...
--config
Config settings for the command. These override lvm.conf settings. The String arg uses the same formatas lvm.conf, or may use section/field syntax. See lvm.conf(5) for more information about config.
vgcreate --config ...
--dataalignment
Align the start of the data to a multiple of this number. Also specify an appropriate Physical Extentsize when creating a VG. To see the location of the first Physical Extent of an existing PV, use pvs
vgcreate --dataalignment ...
--dataalignmentoffset
Shift the start of the data area by this additional offset.
vgcreate --dataalignmentoffset ...
-d|--debug
Set debug level. Repeat from 1 to 6 times to increase the detail of messages sent to the log fileand/or syslog (if configured).
vgcreate -d|--debug ...
--driverloaded
If set to no, the command will not attempt to use device-mapper. For testing and debugging.
vgcreate --driverloaded ...
-f|--force
Override various checks, confirmations and protections. Use with extreme caution.
vgcreate -f|--force ...
-h|--help
Display help text.
vgcreate -h|--help ...
--labelsector
By default the PV is labelled with an LVM2 identifier in its second sector (sector 1). This lets youuse a different sector near the start of the disk (between 0 and 3 inclusive - see LABEL_SCAN_SECTORSin the source). Use with care.
vgcreate --labelsector ...
--lockopt
Used to pass options for special cases to lvmlockd. See lvmlockd(8) for more information.
vgcreate --lockopt ...
--locktype
Specify the VG lock type directly in place of using --shared. See lvmlockd(8) for more information.
vgcreate --locktype ...
--longhelp
Display long help text.
vgcreate --longhelp ...
-l|--maxlogicalvolumes
Sets the maximum number of LVs allowed in a VG.
vgcreate -l|--maxlogicalvolumes ...
-p|--maxphysicalvolumes
Sets the maximum number of PVs that can belong to the VG. The value 0 removes any limitation. Forlarge numbers of PVs, also see options --pvmetadatacopies, and --vgmetadatacopies for improving perfor‐mance.
vgcreate -p|--maxphysicalvolumes ...
--metadataprofile
The metadata profile to use for command configuration. See lvm.conf(5) for more information about pro‐files.
vgcreate --metadataprofile ...
--metadatasize
The approximate amount of space used for each VG metadata area. The size may be rounded.
vgcreate --metadatasize ...
-M|--metadatatype
Specifies the type of on-disk metadata to use. lvm2 (or just 2) is the current, standard format. lvm1(or just 1) is a historical format that can be used for accessing old data.
vgcreate -M|--metadatatype ...
-s|--physicalextentsize
Sets the physical extent size of PVs in the VG. The value must be either a power of 2 of at least 1sector (where the sector size is the largest sector size of the PVs currently used in the VG), or atleast 128KiB. Once this value has been set, it is difficult to change without recreating the VG,unless no extents need moving.
vgcreate -s|--physicalextentsize ...
--profile
An alias for --commandprofile or --metadataprofile, depending on the command.
vgcreate --profile ...
--pvmetadatacopies
The number of metadata areas to set aside on a PV for storing VG metadata. When 2, one copy of the VGmetadata is stored at the front of the PV and a second copy is stored at the end. When 1, one copy ofthe VG metadata is stored at the front of the PV (starting in the 5th sector). When 0, no copies ofthe VG metadata are stored on the given PV. This may be useful in VGs containing many PVs (this placeslimitations on the ability to use vgsplit later.)
vgcreate --pvmetadatacopies ...
-q|--quiet
Suppress output and log messages. Overrides --debug and --verbose. Repeat once to also suppress anyprompts with answer 'no'.
vgcreate -q|--quiet ...
--reportformat
Overrides current output format for reports which is defined globally by the report/output_format set‐ting in lvm.conf. basic is the original format with columns and rows. If there is more than onereport per command, each report is prefixed with the report name for identification. json producesreport output in JSON format. See lvmreport(7) for more information.
vgcreate --reportformat ...
--shared
Create a shared VG using lvmlockd if LVM is compiled with lockd support. lvmlockd will select locktype sanlock or dlm depending on which lock manager is running. This allows multiple hosts to share aVG on shared devices. lvmlockd and a lock manager must be configured and running. (A shared VG usinglvmlockd is different from a clustered VG using clvmd.) See lvmlockd(8) for more information aboutshared VGs.
vgcreate --shared ...
--systemid
Specifies the system ID that will be given to the new VG, overriding the system ID of the host runningthe command. A VG is normally created without this option, in which case the new VG is given the systemID of the host creating it. Using this option requires caution because the system ID of the new VG maynot match the system ID of the host running the command, leaving the VG inaccessible to the host. Seelvmsystemid(7) for more information.
vgcreate --systemid ...
-t|--test
Run in test mode. Commands will not update metadata. This is implemented by disabling all metadatawriting but nevertheless returning success to the calling function. This may lead to unusual error mes‐sages in multi-stage operations if a tool relies on reading back metadata it believes has changed buthasn't.
vgcreate -t|--test ...
-v|--verbose
Set verbose level. Repeat from 1 to 4 times to increase the detail of messages sent to stdout andstderr.
vgcreate -v|--verbose ...
--version
Display version information.
vgcreate --version ...
--[vg]metadatacopies
Number of copies of the VG metadata that are kept. VG metadata is kept in VG metadata areas on PVs inthe VG, i.e. reserved space at the start and/or end of the PVs. Keeping a copy of the VG metadata onevery PV can reduce performance in VGs containing a large number of PVs. When this number is set to anon-zero value, LVM will automatically choose PVs on which to store metadata, using the metadataignoreflags on PVs to achieve the specified number. The number can also be replaced with special string val‐ues: unmanaged causes LVM to not automatically manage the PV metadataignore flags. all causes LVM tofirst clear the metadataignore flags on all PVs, and then to become unmanaged.
vgcreate --[vg]metadatacopies ...
-y|--yes
Do not prompt for confirmation interactively but always assume the answer yes. Use with extreme cau‐tion. (For automatic no, see -qq.)
vgcreate -y|--yes ...
-Z|--zero
Controls if the first 4 sectors (2048 bytes) of the device are wiped. The default is to wipe thesesectors unless either or both of --restorefile or --uuid are specified.VARIABLESVGVolume Group name. See lvm(8) for valid names.PVPhysical Volume name, a device path under /dev. For commands managing physical extents, a PV posi‐tional arg generally accepts a suffix indicating a range (or multiple ranges) of physical extents(PEs). When the first PE is omitted, it defaults to the start of the device, and when the last PE isomitted it defaults to end. Start and end range (inclusive): PV[:PE-PE]... Start and length range(counting from 0): PV[:PE+PE]...StringSee the option description for information about the string content.Size[UNIT]Size is an input number that accepts an optional unit. Input units are always treated as base two val‐ues, regardless of capitalization, e.g. 'k' and 'K' both refer to 1024. The default input unit isspecified by letter, followed by |UNIT. UNIT represents other possible input units: bBsSkKmMgGtTpPeE.b|B is bytes, s|S is sectors of 512 bytes, k|K is kilobytes, m|M is megabytes, g|G is gigabytes, t|T isterabytes, p|P is petabytes, e|E is exabytes. (This should not be confused with the output control
vgcreate -Z|--zero ...
--units,
ENVIRONMENT VARIABLESSee lvm(8) for information about environment variables used by lvm. For example, LVM_VG_NAME can generally besubstituted for a required VG parameter.EXAMPLESCreate a VG with two PVs, using the default physical extent size.vgcreate myvg /dev/sdk1 /dev/sdl1
vgcreate --units, ...