Linux "lvcreate" Command Line Options and Examples
Create a logical volume

lvcreate creates a new LV in a VG. For standard LVs, this requires allocating logical extents from the VG's free physical extents. If there is not enough free space, the VG can be extended with other PVs (vgextend(8)), or existing LVs can be reduced or removed (lvre‐ move(8), lvreduce(8).


Usage:

lvcreate option_args position_args
[ option_args ]
[ position_args ]






Command Line Options:

-a|--activate
Controls the active state of the new LV. y makes the LV active, or available. New LVs are made active by default. n makesthe LV inactive, or unavailable, only when possible. In some cases, creating an LV requires it to be active. For example,COW snapshots of an active origin LV can only be created in the active state (this does not apply to thin snapshots). The
lvcreate -a|--activate ...
--addtag
Adds a tag to a PV, VG or LV. This option can be repeated to add multiple tags at once. See lvm(8) for information about tags.
lvcreate --addtag ...
--alloc
Determines the allocation policy when a command needs to allocate Physical Extents (PEs) from the VG. Each VG and LV has anallocation policy which can be changed with vgchange/lvchange, or overriden on the command line. normal applies common senserules such as not placing parallel stripes on the same PV. inherit applies the VG policy to an LV. contiguous requires newPEs be placed adjacent to existing PEs. cling places new PEs on the same PV as existing PEs in the same stripe of the LV. Ifthere are sufficient PEs for an allocation, but normal does not use them, anywhere will use them even if it reduces perfor‐mance, e.g. by placing two stripes on the same PV. Optional positional PV args on the command line can also be used to limitwhich PVs the command will use for allocation. See lvm(8) for more information about allocation.
lvcreate --alloc ...
-A|--autobackup
Specifies if metadata should be backed up automatically after a change. Enabling this is strongly advised! See vgcfgbackup(8)for more information.
lvcreate -A|--autobackup ...
-H|--cache
Specifies the command is handling a cache LV or cache pool. See --type cache and --type cache-pool. See lvmcache(7) for moreinformation about LVM caching.
lvcreate -H|--cache ...
--cachemetadataformat
Specifies the cache metadata format used by cache target.
lvcreate --cachemetadataformat ...
--cachemode
Specifies when writes to a cache LV should be considered complete. writeback considers a write complete as soon as it isstored in the cache pool. writethough considers a write complete only when it has been stored in both the cache pool and onthe origin LV. While writethrough may be slower for writes, it is more resilient if something should happen to a device asso‐ciated with the cache pool LV. With passthrough, all reads are served from the origin LV (all reads miss the cache) and allwrites are forwarded to the origin LV; additionally, write hits cause cache block invalidates. See lvmcache(7) for more infor‐mation.
lvcreate --cachemode ...
--cachepolicy
Specifies the cache policy for a cache LV. See lvmcache(7) for more information.
lvcreate --cachepolicy ...
--cachepool
The name of a cache pool LV.
lvcreate --cachepool ...
--cachesettings
Specifies tunable values for a cache LV in "Key = Value" form. Repeat this option to specify multiple values. (The defaultvalues should usually be adequate.) The special string value default switches settings back to their default kernel valuesand removes them from the list of settings stored in LVM metadata. See lvmcache(7) for more information.
lvcreate --cachesettings ...
-c|--chunksize
The size of chunks in a snapshot, cache pool or thin pool. For snapshots, the value must be a power of 2 between 4KiB and512KiB and the default value is 4. For a cache pool the value must be between 32KiB and 1GiB and the default value is 64.For a thin pool the value must be between 64KiB and 1GiB and the default value starts with 64 and scales up to fit the poolmetadata size within 128MiB, if the pool metadata size is not specified. The value must be a multiple of 64KiB. Seelvmthin(7) and lvmcache(7) for more information.
lvcreate -c|--chunksize ...
--commandprofile
The command profile to use for command configuration. See lvm.conf(5) for more information about profiles.
lvcreate --commandprofile ...
--config
Config settings for the command. These override lvm.conf settings. The String arg uses the same format as lvm.conf, or mayuse section/field syntax. See lvm.conf(5) for more information about config.
lvcreate --config ...
-C|--contiguous
Sets or resets the contiguous allocation policy for LVs. Default is no contiguous allocation based on a next free principle.It is only possible to change a non-contiguous allocation policy to contiguous if all of the allocated physical extents in theLV are already contiguous.
lvcreate -C|--contiguous ...
-d|--debug
Set debug level. Repeat from 1 to 6 times to increase the detail of messages sent to the log file and/or syslog (if config‐ured).
lvcreate -d|--debug ...
--discards
Specifies how the device-mapper thin pool layer in the kernel should handle discards. ignore causes the thin pool to ignorediscards. nopassdown causes the thin pool to process discards itself to allow reuse of unneeded extents in the thin pool.passdown causes the thin pool to process discards itself (like nopassdown) and pass the discards to the underlying device.See lvmthin(7) for more information.
lvcreate --discards ...
--driverloaded
If set to no, the command will not attempt to use device-mapper. For testing and debugging.
lvcreate --driverloaded ...
--errorwhenfull
Specifies thin pool behavior when data space is exhausted. When yes, device-mapper will immediately return an error when athin pool is full and an I/O request requires space. When no, device-mapper will queue these I/O requests for a period oftime to allow the thin pool to be extended. Errors are returned if no space is available after the timeout. (Also see dm-thin-pool kernel module option no_space_timeout.) See lvmthin(7) for more information.
lvcreate --errorwhenfull ...
-l|--extents
Specifies the size of the new LV in logical extents. The --size and --extents options are alternate methods of specifyingsize. The total number of physical extents used will be greater when redundant data is needed for RAID levels. An alternatesyntax allows the size to be determined indirectly as a percentage of the size of a related VG, LV, or set of PVs. The suffix%VG denotes the total size of the VG, the suffix %FREE the remaining free space in the VG, and the suffix %PVS the free spacein the specified PVs. For a snapshot, the size can be expressed as a percentage of the total size of the origin LV with thesuffix %ORIGIN (100%ORIGIN provides space for the whole origin). When expressed as a percentage, the size defines an upperlimit for the number of logical extents in the new LV. The precise number of logical extents in the new LV is not determineduntil the command has completed.
lvcreate -l|--extents ...
-h|--help
Display help text.
lvcreate -h|--help ...
-K|--ignoreactivationskip
Ignore the "activation skip" LV flag during activation to allow LVs with the flag set to be activated.
lvcreate -K|--ignoreactivationskip ...
--ignoremonitoring
Do not interact with dmeventd unless --monitor is specified. Do not use this if dmeventd is already monitoring a device.
lvcreate --ignoremonitoring ...
--longhelp
Display long help text.
lvcreate --longhelp ...
-j|--major
Sets the major number of an LV block device.
lvcreate -j|--major ...
--[raid]maxrecoveryrate
Sets the maximum recovery rate for a RAID LV. The rate value is an amount of data per second for each device in the array.Setting the rate to 0 means it will be unbounded. See lvmraid(7) for more information.
lvcreate --[raid]maxrecoveryrate ...
--metadataprofile
The metadata profile to use for command configuration. See lvm.conf(5) for more information about profiles.
lvcreate --metadataprofile ...
--minor
Sets the minor number of an LV block device.
lvcreate --minor ...
--[raid]minrecoveryrate
Sets the minimum recovery rate for a RAID LV. The rate value is an amount of data per second for each device in the array.Setting the rate to 0 means it will be unbounded. See lvmraid(7) for more information.
lvcreate --[raid]minrecoveryrate ...
--mirrorlog
Specifies the type of mirror log for LVs with the "mirror" type (does not apply to the "raid1" type.) disk is a persistentlog and requires a small amount of storage space, usually on a separate device from the data being mirrored. core is not per‐sistent; the log is kept only in memory. In this case, the mirror must be synchronized (by copying LV data from the firstdevice to others) each time the LV is activated, e.g. after reboot. mirrored is a persistent log that is itself mirrored, butshould be avoided. Instead, use the raid1 type for log redundancy.
lvcreate --mirrorlog ...
-m|--mirrors
Specifies the number of mirror images in addition to the original LV image, e.g. --mirrors 1 means there are two images of thedata, the original and one mirror image. Optional positional PV args on the command line can specify the devices the imagesshould be placed on. There are two mirroring implementations: "raid1" and "mirror". These are the names of the correspondingLV types, or "segment types". Use the --type option to specify which to use (raid1 is default, and mirror is legacy) Uselvm.conf global/mirror_segtype_default and global/raid10_segtype_default to configure the default types. See the --nosyncoption for avoiding initial image synchronization. See lvmraid(7) for more information.
lvcreate -m|--mirrors ...
--monitor
Start (yes) or stop (no) monitoring an LV with dmeventd. dmeventd monitors kernel events for an LV, and performs automatedmaintenance for the LV in reponse to specific events. See dmeventd(8) for more information.
lvcreate --monitor ...
-n|--name
Specifies the name of a new LV. When unspecified, a default name of "lvol#" is generated, where # is a number generated byLVM.
lvcreate -n|--name ...
--nosync
Causes the creation of mirror, raid1, raid4, raid5 and raid10 to skip the initial synchronization. In case of mirror, raid1and raid10, any data written afterwards will be mirrored, but the original contents will not be copied. In case of raid4 andraid5, no parity blocks will be written, though any data written afterwards will cause parity blocks to be stored. This isuseful for skipping a potentially long and resource intensive initial sync of an empty mirror/raid1/raid4/raid5 and raid10 LV.This option is not valid for raid6, because raid6 relies on proper parity (P and Q Syndromes) being created during initialsynchronization in order to reconstruct proper user date in case of device failures. raid0 and raid0_meta do not provide anydata copies or parity support and thus do not support initial synchronization.
lvcreate --nosync ...
--noudevsync
Disables udev synchronisation. The process will not wait for notification from udev. It will continue irrespective of any pos‐sible udev processing in the background. Only use this if udev is not running or has rules that ignore the devices LVM cre‐ates.
lvcreate --noudevsync ...
-p|--permission
Set access permission to read only r or read and write rw.
lvcreate -p|--permission ...
-M|--persistent
When yes, makes the specified minor number persistent.
lvcreate -M|--persistent ...
--poolmetadatasize
Specifies the size of the new pool metadata LV.
lvcreate --poolmetadatasize ...
--poolmetadataspare
Enable or disable the automatic creation and management of a spare pool metadata LV in the VG. A spare metadata LV is reservedspace that can be used when repairing a pool.
lvcreate --poolmetadataspare ...
--profile
An alias for --commandprofile or --metadataprofile, depending on the command.
lvcreate --profile ...
-q|--quiet
Suppress output and log messages. Overrides --debug and --verbose. Repeat once to also suppress any prompts with answer 'no'.
lvcreate -q|--quiet ...
-r|--readahead
Sets read ahead sector count of an LV. auto is the default which allows the kernel to choose a suitable value automatically.none is equivalent to zero.
lvcreate -r|--readahead ...
-R|--regionsize
Size of each raid or mirror synchronization region. lvm.conf activation/raid_region_size can be used to configure a default.
lvcreate -R|--regionsize ...
--reportformat
Overrides current output format for reports which is defined globally by the report/output_format setting in lvm.conf. basicis the original format with columns and rows. If there is more than one report per command, each report is prefixed with thereport name for identification. json produces report output in JSON format. See lvmreport(7) for more information.
lvcreate --reportformat ...
-k|--setactivationskip
Persistently sets (yes) or clears (no) the "activation skip" flag on an LV. An LV with this flag set is not activated unlessthe --ignoreactivationskip option is used by the activation command. This flag is set by default on new thin snapshot LVs.The flag is not applied to deactivation. The current value of the flag is indicated in the lvs lv_attr bits.
lvcreate -k|--setactivationskip ...
-L|--size
Specifies the size of the new LV. The --size and --extents options are alternate methods of specifying size. The total num‐ber of physical extents used will be greater when redundant data is needed for RAID levels.
lvcreate -L|--size ...
-s|--snapshot
Create a snapshot. Snapshots provide a "frozen image" of an origin LV. The snapshot LV can be used, e.g. for backups, whilethe origin LV continues to be used. This option can create a COW (copy on write) snapshot, or a thin snapshot (in a thinpool.) Thin snapshots are created when the origin is a thin LV and the size option is NOT specified. Thin snapshots share thesame blocks in the thin pool, and do not allocate new space from the VG. Thin snapshots are created with the "activationskip" flag, see --setactivationskip. A thin snapshot of a non-thin "external origin" LV is created when a thin pool is speci‐fied. Unprovisioned blocks in the thin snapshot LV are read from the external origin LV. The external origin LV must be read-only. See lvmthin(7) for more information about LVM thin provisioning. COW snapshots are created when a size is specified.The size is allocated from space in the VG, and is the amount of space that can be used for saving COW blocks as writes occurto the origin or snapshot. The size chosen should depend upon the amount of writes that are expected; often 20% of the originLV is enough. If COW space runs low, it can be extended with lvextend (shrinking is also allowed with lvreduce.) A smallamount of the COW snapshot LV size is used to track COW block locations, so the full size is not available for COW datablocks. Use lvs to check how much space is used, and see --monitor to to automatically extend the size to avoid running outof space.
lvcreate -s|--snapshot ...
-i|--stripes
Specifies the number of stripes in a striped LV. This is the number of PVs (devices) that a striped LV is spread across. Datathat appears sequential in the LV is spread across multiple devices in units of the stripe size (see --stripesize). This doesnot change existing allocated space, but only applies to space being allocated by the command. When creating a RAID 4/5/6 LV,this number does not include the extra devices that are required for parity. The largest number depends on the RAID type(raid0: 64, raid10: 32, raid4/5: 63, raid6: 62), and when unspecified, the default depends on the RAID type (raid0: 2, raid10:2, raid4/5: 3, raid6: 5.) To stripe a new raid LV across all PVs by default, see lvm.conf allocation/raid_stripe_all_devices.
lvcreate -i|--stripes ...
-I|--stripesize
The amount of data that is written to one device before moving to the next in a striped LV.
lvcreate -I|--stripesize ...
-t|--test
Run in test mode. Commands will not update metadata. This is implemented by disabling all metadata writing but neverthelessreturning success to the calling function. This may lead to unusual error messages in multi-stage operations if a tool relieson reading back metadata it believes has changed but hasn't.
lvcreate -t|--test ...
-T|--thin
Specifies the command is handling a thin LV or thin pool. See --type thin, --type thin-pool, and --virtualsize. Seelvmthin(7) for more information about LVM thin provisioning.
lvcreate -T|--thin ...
--thinpool
The name of a thin pool LV.
lvcreate --thinpool ...
--type
The LV type, also known as "segment type" or "segtype". See usage descriptions for the specific ways to use these types. Formore information about redundancy and performance (raid<N>, mirror, striped, linear) see lvmraid(7). For thin provisioning(thin, thin-pool) see lvmthin(7). For performance caching (cache, cache-pool) see lvmcache(7). For copy-on-write snapshots(snapshot) see usage definitions. Several commands omit an explicit type option because the type is inferred from otheroptions or shortcuts (e.g. --stripes, --mirrors, --snapshot, --virtualsize, --thin, --cache). Use inferred types with carebecause it can lead to unexpected results.
lvcreate --type ...
-v|--verbose
Set verbose level. Repeat from 1 to 4 times to increase the detail of messages sent to stdout and stderr.
lvcreate -v|--verbose ...
--version
Display version information.
lvcreate --version ...
-V|--virtualsize
The virtual size of a new thin LV. See lvmthin(7) for more information about LVM thin provisioning. Using virtual size (-V)and actual size (-L) together creates a sparse LV. lvm.conf global/sparse_segtype_default determines the default segment typeused to create a sparse LV. Anything written to a sparse LV will be returned when reading from it. Reading from other areasof the LV will return blocks of zeros. When using a snapshot to create a sparse LV, a hidden virtual device is created usingthe zero target, and the LV has the suffix _vorigin. Snapshots are less efficient than thin provisioning when creating largesparse LVs (GiB).
lvcreate -V|--virtualsize ...
-W|--wipesignatures
Controls detection and subsequent wiping of signatures on new LVs. There is a prompt for each signature detected to confirmits wiping (unless --yes is used to override confirmations.) When not specified, signatures are wiped whenever zeroing isdone (see --zero). This behaviour can be configured with lvm.conf allocation/wipe_signatures_when_zeroing_new_lvs. If blkidwiping is used (lvm.conf allocation/use_blkid_wiping) and LVM is compiled with blkid wiping support, then the blkid(8) libraryis used to detect the signatures (use blkid -k to list the signatures that are recognized). Otherwise, native LVM code isused to detect signatures (only MD RAID, swap and LUKS signatures are detected in this case.) The LV is not wiped if the readonly flag is set.
lvcreate -W|--wipesignatures ...
-y|--yes
Do not prompt for confirmation interactively but always assume the answer yes. Use with extreme caution. (For automatic no,see -qq.)
lvcreate -y|--yes ...
-Z|--zero
Controls zeroing of the first 4KiB of data in the new LV. Default is y. Snapshot COW volumes are always zeroed. LV is notzeroed if the read only flag is set. Warning: trying to mount an unzeroed LV can cause the system to hang.VARIABLESVGVolume Group name. See lvm(8) for valid names. For lvcreate, the required VG positional arg may be omitted when the VG nameis included in another option, e.g. --name VG/LV.LVLogical Volume name. See lvm(8) for valid names. An LV positional arg generally includes the VG name and LV name, e.g.VG/LV. LV followed by _<type> indicates that an LV of the given type is required. (raid represents raid<N> type)PVPhysical Volume name, a device path under /dev. For commands managing physical extents, a PV positional arg generally acceptsa suffix indicating a range (or multiple ranges) of physical extents (PEs). When the first PE is omitted, it defaults to thestart of the device, and when the last PE is omitted 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 values, regardless of capi‐talization, e.g. 'k' and 'K' both refer to 1024. The default input unit is specified by letter, followed by |UNIT. UNIT rep‐resents other possible input units: bBsSkKmMgGtTpPeE. b|B is bytes, s|S is sectors of 512 bytes, k|K is kilobytes, m|M ismegabytes, g|G is gigabytes, t|T is terabytes, p|P is petabytes, e|E is exabytes. (This should not be confused with the out‐put control --units, where capital letters mean multiple of 1000.)ENVIRONMENT VARIABLESSee lvm(8) for information about environment variables used by lvm. For example, LVM_VG_NAME can generally be substituted for arequired VG parameter.ADVANCED USAGEAlternate command forms, advanced command usage, and listing of all valid syntax for completeness.Create an LV that returns errors when used.lvcreate --type error -L|--size Size[m|UNIT] VG
lvcreate -Z|--zero ...
-
Create an LV that returns zeros when read.lvcreate --type zero -L|--size Size[m|UNIT] VG
lvcreate - ...
-V
Create a thin snapshot of a thin LV (the size option must not be used, otherwise a copy-on-write snapshot would be created).lvcreate --snapshot --name mysnap vg00/thinvolCreate a thin snapshot of the read-only inactive LV named "origin" which becomes an external origin for the thin snapshot LV.lvcreate --snapshot --name mysnap --thinpool mypool vg00/originCreate a cache pool from a fast physical device. The cache pool can then be used to cache an LV.lvcreate --type cache-pool -L 1G -n my_cpool vg00 /dev/fast1Create a cache LV, first creating a new origin LV on a slow physical device, then combining the new origin LV with an existing cachepool.lvcreate --type cache --cachepool my_cpool
lvcreate -V ...
-L
100G -n mylv vg00 /dev/slow1
lvcreate -L ...