VGCREATE(8)

πŸ¦‹ VGCREATE(8) β€” System Manager's Manual πŸ¦‹

okay bestie, welcome to the vgcreate page, manual section 8 (that's the system-manager one, iykyk) πŸ’–


πŸŽ€ NAME

vgcreate β€” create a volume group. that's it, that's the whole vibe. making a brand new VG out here ✨


🌸 SYNOPSIS

vgcreate position_args
       [ option_args ]

like, give it your position args, and optionally some options, periodt πŸ’…


πŸ’œ DESCRIPTION

okay so vgcreate creates a brand new VG on block devices πŸ”₯ and here's the cute part: if those devices weren't already initialized as PVs with pvcreate(8) first, then vgcreate will just... do it for them. it initializes them, makes them PVs, no extra steps needed 🫢. and the pvcreate options for initializing devices are also available with vgcreate, so you're not missing out on anything.

now, the important tea β˜•: when vgcreate uses an existing PV, that PV's existing values for metadata size, PE start, etc., get used β€” even if you specified different values in the vgcreate command. so like, your flags said one thing and the PV said another and the PV wins, sorry bestie 😭. to actually change those values, you have to first use pvremove on the device. no shortcuts, unfortunately.


✨ USAGE ✨

vgcreate VG_new PV ...
       [ -A|--autobackup y|n ]
       [ -c|--clustered y|n ]
       [ -f|--force ... ]
       [ -l|--maxlogicalvolumes Number ]
       [ -M|--metadatatype lvm2 ]
       [ -p|--maxphysicalvolumes Number ]
       [ -s|--physicalextentsize Size[m|UNIT] ]
       [ -Z|--zero y|n ]
       [ --addtag Tag ]
       [ --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit
       ]
       [ --dataalignment Size[k|UNIT] ]
       [ --dataalignmentoffset Size[k|UNIT] ]
       [ --labelsector Number ]
       [ --locktype none ]
       [ --metadataprofile String ]
       [ --metadatasize Size[m|UNIT] ]
       [ --persist start ]
       [ --pvmetadatacopies 0|1|2 ]
       [ --reportformat basic|json|json_std ]
       [ --setautoactivation y|n ]
       [ --setlockargs String ]
       [ --setpersist String ]
       [ --shared ]
       [ --systemid String ]
       [ --[vg]metadatacopies all|unmanaged|Number ]
       [ COMMON_OPTIONS ]

β€”

and here's the common options for lvm, the little shared starter pack every lvm command gets 🧚:

Common options for lvm:
       [ -d|--debug ... ]
       [ -h|--help ]
       [ -q|--quiet ... ]
       [ -t|--test ]
       [ -v|--verbose ... ]
       [ -y|--yes ]
       [ --commandprofile String ]
       [ --config String ]
       [ --devices PV ]
       [ --devicesfile String ]
       [ --driverloaded y|n ]
       [ --journal String ]
       [ --lockopt String ]
       [ --longhelp ]
       [ --nohints ]
       [ --nolocking ]
       [ --profile String ]
       [ --version ]

πŸ‘‘ OPTIONS

  • --addtag Tag β€” slaps a tag onto a PV, VG or LV 🏷️. you can repeat this option to add a whole bunch of tags at once. tag lore lives in lvm(8), go read it.
  • --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit β€” this decides the allocation policy when a command needs to allocate Physical Extents (PEs) out of the VG. every VG and LV has an allocation policy, and you can change it with vgchange/lvchange, or just override it right here on the command line. so:
    • normal applies common sense rules, like not putting parallel stripes on the same PV (as it should πŸ’…)
    • inherit applies the VG policy to an LV
    • contiguous requires new PEs to be placed adjacent to existing PEs
    • cling places new PEs on the same PV as existing PEs in the same stripe of the LV
    • if there are enough PEs for an allocation but normal won't use them, anywhere will use them anyway β€” even if it hurts performance, e.g. by putting two stripes on the same PV πŸ’€
    • optional positional PV args on the command line can also limit which PVs the command will use for allocation. see lvm(8) for more allocation lore.
  • -A|--autobackup y|n β€” says whether metadata should be backed up automatically after a change. enabling this is strongly advised! see vgcfgbackup(8) for more. fr fr, turn it on πŸ™
  • -c|--clustered y|n β€” this one was specific to clvm and is now replaced by the --shared option with lvmlockd(8). so like, it's giving legacy, bestie πŸ’€
  • --commandprofile String β€” the command profile to use for command configuration. lvm.conf(5) has the profile details.
  • --config String β€” config settings for the command. these override lvm.conf(5) settings. the String arg uses the same format as lvm.conf(5), or it may use section/field syntax. more config tea in lvm.conf(5).
  • --dataalignment Size[k|UNIT] β€” aligns the start of a PV data area to a multiple of this number ✨. wanna see where the first Physical Extent (PE) of an existing PV lives? use pvs -o +pe_start. it may also be shifted by an alignment offset, see --dataalignmentoffset. also, specify an appropriate PE size when creating a VG, don't forget that part 🫢
  • --dataalignmentoffset Size[k|UNIT] β€” shifts the start of the PV data area by this extra offset.
  • -d|--debug ... β€” sets the debug level. repeat it 1 to 6 times to crank up the detail of messages sent to the log file and/or syslog (if configured).
  • --devices PV β€” restricts which devices are visible and accessible to the command. devices not listed will appear to be missing πŸ‘». you can repeat this option, or hand it a comma-separated list of devices. this overrides the devices file.
  • --devicesfile String β€” a file listing the devices LVM should use. it has to exist in /etc/lvm/devices/ and it's managed with the lvmdevices(8) command. this one overrides the lvm.conf(5) devices/devicesfile and devices/use_devicesfile settings.
  • --driverloaded y|n β€” set it to no and the command won't even try to use device-mapper. for testing and debugging only, bestie πŸ§ͺ
  • -f|--force ... β€” overrides various checks, confirmations and protections. use with extreme caution. like, this is the "i know what i'm doing" button and sometimes people do NOT know what they're doing 😭
  • -h|--help β€” displays help text πŸ’–
  • --journal String β€” records information in the systemd journal. this is in addition to whatever the lvm.conf log/journal setting already turns on. the values:
    • command: records info about the command
    • output: records the default command output
    • debug: records full command debugging
  • --labelsector Number β€” by default the PV gets labelled with an LVM2 identifier in its second sector (sector 1). this option lets you use a different sector near the start of the disk (between 0 and 3 inclusive β€” see LABEL_SCAN_SECTORS in the source). use with care.
  • --lockopt String β€” used to pass options for special cases to lvmlockd. lvmlockd(8) has more.
  • --locktype none β€” specify the VG lock type directly, in place of using --shared. more in lvmlockd(8).
  • --longhelp β€” displays long help text.
  • -l|--maxlogicalvolumes Number β€” sets the maximum number of LVs allowed in a VG.
  • -p|--maxphysicalvolumes Number β€” sets the maximum number of PVs that can belong to the VG. value 0 removes any limitation. for large numbers of PVs, also check out the --pvmetadatacopies and --vgmetadatacopies options for improving performance πŸ”₯
  • --metadataprofile String β€” the metadata profile to use for command configuration. lvm.conf(5) has more about profiles.
  • --metadatasize Size[m|UNIT] β€” the approximate amount of space used for each VG metadata area. and yes, the size may be rounded, that's just how it is πŸ™ˆ
  • -M|--metadatatype lvm2 β€” specifies the type of on-disk metadata to use. lvm2 (or just 2) is the current, standard format πŸ‘‘. lvm1 (or just 1) is no longer used, rip bozo.
  • --nohints β€” don't use the hints file to locate devices for PVs. without hints, a command may read more devices to find PVs. it will still perform standard hint file invalidation where appropriate though, so no chaos.
  • --nolocking β€” disables locking. use with caution, concurrent commands may produce incorrect results. πŸ’€
  • --persist String β€” the Persistent Reservation operation. the rundown:
    • start: register local key and acquire reservation
    • stop: unregister local key, releasing reservation
    • remove: preempt and abort another key
    • clear: remove reservation and keys
    • check: check if started
    • autostart: start if the VG autostart flag is set
    • lvmlocal.conf pr_key or host_id must be configured to use PR
    • for local VGs, Write Exclusive (WE) is used, and for shared VGs, Write Exclusive, all registrants (WEAR) is used
    • use --setpersist to automate and/or require PR ✨
  • -s|--physicalextentsize Size[m|UNIT] β€” sets the physical extent size of PVs in the VG. the value must be either a power of 2 of at least 1 sector (where the sector size is the largest sector size of the PVs currently used in the VG), or at least 128 KiB. and heads up: once this value has been set, it is difficult to change without recreating the VG, unless no extents need moving 😬 so choose wisely bestie.
  • --profile String β€” an alias for --commandprofile or --metadataprofile, depending on the command.
  • --pvmetadatacopies 0|1|2 β€” the number of metadata areas to set aside on a PV for storing VG metadata. the deets:
    • when 2, one copy of the VG metadata is stored at the front of the PV and a second copy is stored at the end
    • when 1, one copy of the VG metadata is stored at the front of the PV
    • when 0, no copies of the VG metadata are stored on the given PV
    • this may be useful in VGs containing many PVs β€” though it places limitations on the ability to use vgsplit later ⚠️
  • -q|--quiet ... β€” suppress output and log messages. overrides --debug and --verbose. repeat it once to also suppress any prompts with answer 'no'.
  • --reportformat basic|json|json_std β€” overrides the current output format for reports, which is defined globally by the report/output_format setting in lvm.conf(5). so:
    • basic is the original format with columns and rows. if there's more than one report per command, each report is prefixed with the report name so you can tell them apart
    • json produces report output in JSON format
    • json_std produces report output in JSON format which is more compliant with the JSON standard 🌈
    • see lvmreport(7) for more
  • --setautoactivation y|n β€” turns the autoactivation property on or off for a VG or an LV πŸ’«. Wanna peek at what it's currently set to? Run vgs or lvs with -o autoactivation. When autoactivation is disabled, that VG or LV will not get activated by any command that does autoactivation β€” so like, vgchange, lvchange, or pvscan using -aay 😀. And the nesting? If autoactivation is disabled on a VG, then no LVs will be autoactivated in that whole VG, and the LV's own autoactivation property just… has no effect, bestie 🫠. If it's enabled on the VG, you can still turn autoactivation off for individual LVs. Hierarchy, gorgeous, we love to see it.
  • --setlockargs String β€” adds or removes lock_args settings for a shared VG πŸ”. These lock_args decide how the lock manager behaves for that VG. Heads up: these settings are only allowed for lock_type sanlock. Here's the menu of values:
    • persist: uses persistent reservations for lock recovery. lvmlockd will preempt-abort the persistent reservation of a failed lock owner so the lock can actually be acquired πŸ’….
    • notimeout: uses locks that do not time out when the owner fails. In that case, a lock owned by a failed host can only be acquired using the persist feature.
    • nopersist: does not use the persist feature.
    • timeout: does not use the notimeout feature.
    • nowatchdog: does not connect to wdmd/watchdog when starting the VG lockspace. Requires notimeout. Without timeout-based recovery, the watchdog isn't needed.
    • watchdog: when starting a VG lockspace, sanlock/wdmd connect the lockspace to /dev/watchdog. If VG lockspace renewals fail (e.g. due to a storage outage, or a sanlock daemon failure), then the watchdog resets the host if locks are held in the VG 😡.
    • The default behavior with no settings configured is: nopersist, timeout, watchdog.
  • --setpersist String β€” set flags that control persistent reservation behavior πŸ“Œ.
    • y: set require and autostart flags.
    • require: PR will be required to write or activate the VG.
    • autostart: PR will be automatically started.
    • ptpl: use persist through power loss on devices.
    • When autostart is enabled, autoactivation and auto-lockstart commands will first start PR.
    • lvmlocal.conf pr_key or host_id must be configured to use PR. And for local VGs, enabling system_id is also recommended.
  • --shared β€” makes a shared VG using lvmlockd if LVM was compiled with lockd support 🫢. lvmlockd will pick lock type sanlock or dlm depending on which lock manager is running. This is the move that lets multiple hosts share a VG on shared devices β€” but lvmlockd and a lock manager must be configured and running. See lvmlockd(8) for more about shared VGs.
  • --systemid String β€” sets the system ID that'll be given to the new VG, overriding the system ID of the host running the command πŸͺͺ. Normally you create a VG without this option, and the new VG just gets the system ID of whatever host created it. Using this requires caution, because the system ID of the new VG may not match the system ID of the host running the command β€” which leaves the VG inaccessible to that host πŸ’€. See lvmsystemid(7) for more.
  • -t, --test β€” run in test mode. Commands will not update metadata πŸ™ˆ. This works by disabling all metadata writing but nevertheless returning success to the calling function. Fair warning: this may lead to unusual error messages in multi-stage operations if a tool relies on reading back metadata it believes has changed but hasn't.
  • -v, --verbose ... β€” set verbose level. Repeat from 1 to 4 times to increase the detail of messages sent to stdout and stderr πŸ—£οΈ.
  • --version β€” display version information. Simple. Iconic. ✨
  • --[vg]metadatacopies all|unmanaged|Number β€” how many copies of the VG metadata are kept πŸ“š. VG metadata lives in VG metadata areas on PVs in the VG, i.e. reserved space at the start and/or end of the PVs. Keeping a copy of the VG metadata on every PV can reduce performance in VGs containing a large number of PVs. When this number is set to a non-zero value, LVM will automatically choose PVs on which to store metadata, using the metadataignore flags on PVs to hit that specified number. And the number can also be swapped for special string values:
    • unmanaged β€” causes LVM to not automatically manage the PV metadataignore flags.
    • all β€” causes LVM to first clear the metadataignore flags on all PVs, and then to become unmanaged.
  • -y, --yes β€” do not prompt for confirmation interactively, just always assume the answer is yes. Use with extreme caution ⚠️. (For automatic no, see -qq.)
  • -Z, --zero y|n β€” controls whether the first 4 sectors (2048 bytes) of the device are wiped 🧹. The default is to wipe these sectors unless either or both of --restorefile or --uuid are specified.

🌸 VARIABLES 🌸

  • VG β€” Volume Group name. See lvm(8) for valid names.
  • PV β€” Physical Volume name, a device path under /dev. For commands managing physical extents, a PV positional 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 is omitted it defaults to the end.
Start and end range (inclusive): PV[:PE-PE] ...
Start and length range (counting from 0): PV[:PE+PE] ...
  • String β€” see the option description for info about the string content. (Every string is unique bestie, check its own blurb πŸŽ€)
  • Size[UNIT] β€” Size is an input number that accepts an optional unit. Input units are always treated as base two values, regardless of capitalization β€” so k and K both refer to 1024, no cap 🫑. The default input unit is specified by letter, followed by |UNIT. UNIT represents the other possible input units: b|B is bytes, s|S is sectors of 512 bytes, k|K is KiB, m|M is MiB, g|G is GiB, t|T is TiB, p|P is PiB, e|E is EiB. And do not confuse this with the output control --units, where capital letters mean a multiple of 1000. Different worlds entirely 🌍.

🌈 ENVIRONMENT VARIABLES 🌈

See lvm(8) for information about environment variables used by lvm. For example, LVM_VG_NAME can generally be substituted for a required VG parameter πŸ’–.


✨ EXAMPLES ✨

Create a VG with two PVs, using the default physical extent size:

vgcreate myvg /dev/sdk1 /dev/sdl1

πŸ¦‹ SEE ALSO πŸ¦‹

lvm(8), lvm.conf(5), lvmconfig(8), lvmdevices(8),

pvchange(8), pvck(8), pvcreate(8), pvdisplay(8), pvmove(8), pvremove(8), pvresize(8), pvs(8), pvscan(8),

vgcfgbackup(8), vgcfgrestore(8), vgchange(8), vgck(8), vgcreate(8), vgconvert(8), vgdisplay(8), vgexport(8), vgextend(8), vgimport(8), vgimportclone(8), vgimportdevices(8), vgmerge(8), vgmknodes(8), vgreduce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8),

lvcreate(8), lvchange(8), lvconvert(8), lvdisplay(8), lvextend(8), lvreduce(8), lvremove(8), lvrename(8), lvresize(8), lvs(8), lvscan(8),

lvm-fullreport(8), lvm-lvpoll(8), blkdeactivate(8), lvmdump(8),

dmeventd(8), lvmpolld(8), lvmlockd(8), lvmlockctl(8), lvmdbusd(8), fsadm(8),

lvmsystemid(7), lvmreport(7), lvmcache(7), lvmraid(7), lvmthin(7), lvmvdo(7), lvmautoactivation(7)


okay that's the whole page bestie, you made it to the end and I'm so proud of you πŸ₯ΉπŸ’– this one is LVM TOOLS 2.03.44(2), dated 2026-10-27, brought to you by Red Hat, Inc. πŸŽ€ now go forth and vgcreate responsibly, and remember: always read the man page before you touch the metadata πŸŒΈβœ¨πŸ‘‘

πŸ“¦ where this page comes from