LVCREATE(8)
๐ LVCREATE(8) โ System Manager's Manual ๐
okay bestie, gather round, because we're about to create logical volumes and it is so much fun once you get it. this is lvcreate from the System Manager's Manual (section 8, iykwim), and she is a whole queen. let me walk you through it ๐ซถ
โจ NAME โจ
lvcreate โ Create a logical volume ๐
โจ SYNOPSIS โจ
okay so the shape of the whole thing is like this, no cap:
lvcreate option_args position_args
[ option_args ]
[ position_args ]
and here is every single option she takes, yes all of them, don't skip ๐ :
-a|--activate y|n|ay
--addtag Tag
--alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit
-A|--autobackup y|n
-H|--cache
--cachedevice PV
--cachemetadataformat auto|1|2
--cachemode writethrough|writeback|passthrough
--cachepolicy String
--cachepool LV
--cachesettings String
--cachesize Size[m|UNIT]
--cachevol LV
-c|--chunksize Size[k|UNIT]
--commandprofile String
--compression y|n
--config String
-C|--contiguous y|n
-d|--debug ...
--deduplication y|n
--devices PV
--devicesfile String
--discards passdown|nopassdown|ignore
--driverloaded y|n
--errorwhenfull y|n
-l|--extents Number[PERCENT]
-h|--help
-K|--ignoreactivationskip
--ignoremonitoring
--integritysettings String
--journal String
--lockopt String
--longhelp
-j|--major Number
--[raid]maxrecoveryrate Size[k|UNIT]
--metadataprofile String
--minor Number
--[raid]minrecoveryrate Size[k|UNIT]
--mirrorlog core|disk
-m|--mirrors Number
--monitor y|n
-n|--name String
--nohints
--nolocking
--nosync
--noudevsync
-p|--permission rw|r
-M|--persistent y|n
--pooldatavdo y|n
--poolmetadatasize Size[m|UNIT]
--poolmetadataspare y|n
--profile String
-q|--quiet ...
--raidintegrity y|n
--raidintegrityblocksize Number
--raidintegritymode String
-r|--readahead auto|none|Number
-R|--regionsize Size[m|UNIT]
--reportformat basic|json|json_std
-k|--setactivationskip y|n
--setautoactivation y|n
-L|--size Size[m|UNIT]
-s|--snapshot
-i|--stripes Number
-I|--stripesize Size[k|UNIT]
-t|--test
-T|--thin
--thinpool LV
--type linear|striped|snapshot|raid|mirror|thin|thin-pool|vdo|
vdo-pool|cache|cache-pool|writecache
--vdo
--vdopool LV
--vdosettings String
-v|--verbose ...
--version
-V|--virtualsize Size[m|UNIT]
-W|--wipesignatures y|n
-y|--yes
-Z|--zero y|n
โจ DESCRIPTION โจ
so like, lvcreate creates a new LV in a VG. that's the whole gig bestie. for standard LVs, that means you have to allocate logical extents out of the VG's free physical extents. and if there's not enough free space? ๐ญ the VG can be extended with other PVs (that's vgextend(8)'s job), or you can reduce / remove existing LVs instead (lvremove(8), lvreduce(8)) ๐ซถ
wanna control which PVs your shiny new LV gets to use? easy. just drop one or more PVs as position args at the end of the command line, and lvcreate will allocate physical extents only from those specified PVs. picky queen behavior, we love it โจ
and guess what โ lvcreate can also create snapshots of existing LVs, like fr fr, for backup purposes and stuff. the data in a new snapshot LV represents the content of the original LV from the time the snapshot was created. time capsule energy ๐
RAID LVs? yeah she can do that, just specify an LV type when creating the LV (peep lvmraid(7)). heads up though: different RAID levels require different numbers of unique PVs to be available in the VG for allocation. so like, do your homework first ๐
Thin pools (for thin provisioning) and cache pools (for caching) are represented by special LVs with types thin-pool and cache-pool (see lvmthin(7) and lvmcache(7)). important: these pool LVs are not usable as standard block devices, but the LV names act as references to the pools. so don't try to mount them, bestie ๐
Thin LVs are thinly provisioned from a thin pool, and are created with a virtual size rather than a physical size. and a cache LV is the combination of a standard LV with a cache pool, used to cache active portions of the LV to improve performance. glow-up via caching ๐ฅ
VDO LVs are also thinly provisioned volumes from a VDO pool, and are created with a virtual size rather than a physical size (see lvmvdo(7)). yes another pool, yes another virtual size, she contains multitudes ๐
๐ธ Usage notes ๐ธ
- in the usage section below,
--size Sizecan be replaced with--extents Number. see the descriptions in the options section for the tea โ - in the usage section below,
--nameis omitted from the required options, even though it is typically used. when the name is not specified, a new LV name is generated with the"lvol"prefix and a unique numeric suffix. she'll name herself, she's independent ๐ - in the usage section below, when creating a pool and the name is omitted, the new LV pool name is generated with the
"vpool"prefix for vdo-pools and a unique numeric suffix ๐ฆ - pool name can be specified together with the VG name, i.e.:
vg00/mythinpoolโ cute lil slash situation, obsessed ๐
ok bestie that's the vibe so far โ but we are SO not done, there are more parts coming, don't go anywhere ๐
๐ USAGE ๐
okay bestie, this is the whole menu of things lvcreate can build for you. pick your fighter ๐
Create a linear LV.
lvcreate -L|--size Size[m|UNIT] VG
[ --type linear ] (implied)
[ -l|--extents Number[PERCENT] ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a striped LV.
lvcreate -i|--stripes Number -L|--size Size[m|UNIT] VG
[ --type striped ] (implied)
[ -l|--extents Number[PERCENT] ]
[ -I|--stripesize Size[k|UNIT] ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a raid1 or mirror LV.
the implicit type here is decided by lvm.conf global/mirror_segtype_default, so like, it picks for you ๐ซถ
lvcreate -L|--size Size[m|UNIT] -m|--mirrors Number VG
[ --type raid1|mirror ] (implied)
[ -l|--extents Number[PERCENT] ]
[ -I|--stripesize Size[k|UNIT] ]
[ -R|--regionsize Size[m|UNIT] ]
[ --integritysettings String ]
[ --[raid]maxrecoveryrate Size[k|UNIT] ]
[ --[raid]minrecoveryrate Size[k|UNIT] ]
[ --mirrorlog core|disk ]
[ --raidintegrity y|n ]
[ --raidintegrityblocksize Number ]
[ --raidintegritymode String ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a raid LV.
heads up, you have to name a specific raid level here, like raid1 โ no vibes-based guessing allowed ๐ค
lvcreate --type raid -L|--size Size[m|UNIT] VG
[ -l|--extents Number[PERCENT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ -m|--mirrors Number ]
[ -R|--regionsize Size[m|UNIT] ]
[ --integritysettings String ]
[ --[raid]maxrecoveryrate Size[k|UNIT] ]
[ --[raid]minrecoveryrate Size[k|UNIT] ]
[ --raidintegrity y|n ]
[ --raidintegrityblocksize Number ]
[ --raidintegritymode String ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a raid10 LV.
lvcreate -i|--stripes Number -L|--size Size[m|UNIT]
-m|--mirrors Number VG
[ --type raid10 ] (implied)
[ -l|--extents Number[PERCENT] ]
[ -I|--stripesize Size[k|UNIT] ]
[ -R|--regionsize Size[m|UNIT] ]
[ --integritysettings String ]
[ --[raid]maxrecoveryrate Size[k|UNIT] ]
[ --[raid]minrecoveryrate Size[k|UNIT] ]
[ --raidintegrity y|n ]
[ --raidintegrityblocksize Number ]
[ --raidintegritymode String ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a COW snapshot LV of an origin LV.
lvcreate -L|--size Size[m|UNIT] -s|--snapshot LV
[ --type snapshot ] (implied)
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a thin pool.
lvcreate --type thin-pool -L|--size Size[m|UNIT] VG
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ -T|--thin ]
[ --compression y|n ]
[ --deduplication y|n ]
[ --discards passdown|nopassdown|ignore ]
[ --errorwhenfull y|n ]
[ --pooldatavdo y|n ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ --thinpool LV ]
[ --vdosettings String ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a cache pool.
lvcreate --type cache-pool -L|--size Size[m|UNIT] VG
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -H|--cache ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ --cachemetadataformat auto|1|2 ]
[ --cachemode writethrough|writeback|passthrough ]
[ --cachepolicy String ]
[ --cachesettings String ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a thin LV in a thin pool.
lvcreate --thinpool LV1 -V|--virtualsize Size[m|UNIT] VG
[ --type thin ] (implied)
[ -T|--thin ]
[ COMMON_OPTIONS ]
LV1 types: thinpool
Create a thin LV that is a snapshot of an existing thin LV.
lvcreate -s|--snapshot LV1
[ --type thin ] (implied)
[ COMMON_OPTIONS ]
LV1 types: thin
Create a thin LV that is a snapshot of an external origin LV.
lvcreate --thinpool LV1 --type thin LV
[ -T|--thin ]
[ COMMON_OPTIONS ]
LV1 types: thinpool
Create a LV that returns VDO when used.
lvcreate --type vdo -L|--size Size[m|UNIT] VG
[ -l|--extents Number[PERCENT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ -V|--virtualsize Size[m|UNIT] ]
[ --compression y|n ]
[ --deduplication y|n ]
[ --vdo ]
[ --vdopool LV ]
[ --vdosettings String ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a new LV, then attach the specified cachepool which converts the new LV to type cache.
lvcreate --cachepool LV1 --type cache
-L|--size Size[m|UNIT] VG
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -H|--cache ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ --cachemetadataformat auto|1|2 ]
[ --cachemode writethrough|writeback|passthrough ]
[ --cachepolicy String ]
[ --cachesettings String ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ COMMON_OPTIONS ]
[ PV ... ]
LV1 types: cachepool
Create a new LV, then attach the specified cachevol which converts the new LV to type cache.
lvcreate --cachevol LV --type cache
-L|--size Size[m|UNIT] VG
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ --cachemetadataformat auto|1|2 ]
[ --cachemode writethrough|writeback|passthrough ]
[ --cachepolicy String ]
[ --cachesettings String ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a new LV, then attach a cachevol created from the specified cache device, which converts the new LV to type cache.
lvcreate --cachedevice PV --type cache
-L|--size Size[m|UNIT] VG
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ --cachemetadataformat auto|1|2 ]
[ --cachemode writethrough|writeback|passthrough ]
[ --cachepolicy String ]
[ --cachesettings String ]
[ --cachesize Size[m|UNIT] ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a new LV, then attach the specified cachevol which converts the new LV to type writecache.
lvcreate --cachevol LV --type writecache
-L|--size Size[m|UNIT] VG
[ -l|--extents Number[PERCENT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ --cachesettings String ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a new LV, then attach a cachevol created from the specified cache device, which converts the new LV to type writecache.
lvcreate --cachedevice PV --type writecache
-L|--size Size[m|UNIT] VG
[ -l|--extents Number[PERCENT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ --cachesettings String ]
[ --cachesize Size[m|UNIT] ]
[ COMMON_OPTIONS ]
[ PV ... ]
๐ซ Common options for command:
these ones are the every-command classics, bestie ๐ซถ
[ -a|--activate y|n|ay ][ -A|--autobackup y|n ][ -C|--contiguous y|n ][ -K|--ignoreactivationskip ][ -j|--major Number ][ -n|--name String ][ -p|--permission rw|r ][ -M|--persistent y|n ][ -r|--readahead auto|none|Number ][ -k|--setactivationskip y|n ][ -W|--wipesignatures y|n ][ -Z|--zero y|n ][ --addtag Tag ][ --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit ][ --ignoremonitoring ][ --metadataprofile String ][ --minor Number ][ --monitor y|n ][ --nosync ][ --noudevsync ][ --reportformat basic|json|json_std ][ --setautoactivation y|n ]
๐ Common options for lvm:
and these are the lvm-wide ones that show up everywhere, no cap โจ
[ -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 ๐
okay so this is the big one. the actual explanations. hydrate first bestie ๐
-a|--activate y|n|ayโ this one controls the active state of your brand new LV, like whether it's up and available or just chillin' unactivated.ymakes the LV active (available, living its best life). New LVs are made active by default btw, that's just the norm ๐ .nmakes the LV inactive (unavailable), but only when possible โ sometimes it just can't. and lowkey, 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, so don't come for me). also the--zerooption normally requires the LV to be active. if autoactivationayis used, the LV is only activated if it matches an item inlvm.conf(5)activation/auto_activation_volume_list. heads up:ayimplies--zero nand--wipesignatures n. and if you're doing shared VGs, go readlvmlockd(8)for more about activation options, iykyk ๐ฅ--addtag Tagโ adds a tag to a PV, VG or LV. you can repeat this option to add multiple tags at once, so go off ๐ธ. want the tea on tags? seelvm(8).--alloccontiguous|cling|cling_by_tags|normal|anywhere|inheritโ okay so this one decides the vibe of where your Physical Extents (PEs, bestie, the actual chunks) get pulled from when a command needs to allocate them out of the VG ๐ Every single VG and every single LV has its own allocation policy, and you can flip it around withvgchange/lvchange, or just override it right here on the command line whenever you feel like it. Let's break it down:normalโ uses common sense rules, like "bestie please do not put parallel stripes on the same PV" ๐ โโ๏ธinheritโ applies the VG policy to an LVcontiguousโ demands that new PEs sit adjacent to the PEs that already existclingโ new PEs go on the same PV as the existing PEs in the same stripe of the LVanywhereโ so if there ARE enough PEs for an allocation butnormalis being picky and won't use them,anywherewill use them anyway, even if it tanks performance, like by placing two stripes on the same PV ๐ญ
oh also! Optional positional PV args on the command line can limit which PVs the command is allowed to use for allocation. See lvm(8) for more info about allocation ๐
-A|--autobackupy|nโ says whether metadata should get backed up automatically after a change. Enabling this is strongly advised! Seevgcfgbackup(8)for the deets โจ-H|--cacheโ tells the command we're dealing with a cache LV or cache pool. See--type cacheand--type cache-pool. Seelvmcache(7)for everything about LVM caching ๐--cachedevicePV โ the name of a device to use for a cache.--cachemetadataformatauto|1|2โ specifies the cache metadata format used by the cache target.--cachemodewritethrough|writeback|passthroughโ specifies when writes to a cache LV should count as complete. Let's go:writebackโ a write is done as soon as it's stored in the cache poolwritethroughโ a write is done only when it's stored in BOTH the cache pool and on the origin LV. Yeah it may be slower for writes, but it's way more resilient if something happens to a device associated with the cache pool LV ๐ชpassthroughโ all reads get served from the origin LV (so all reads miss the cache) and all writes get forwarded to the origin LV; plus, write hits cause cache block invalidates
See lvmcache(7) for more ๐ธ
--cachepolicyString โ specifies the cache policy for a cache LV. Seelvmcache(7)for more.--cachepoolLV โ the name of a cache pool.--cachesettingsString โ specifies tunable kernel options fordm-cacheordm-writecacheLVs. Use the form'option=value'or'option1=value option2=value', or just repeat--cachesettingsfor each option you're setting. These override the default kernel behaviors, which are usually perfectly adequate ngl. To remove cachesettings and revert to the default kernel behaviors, use--cachesettings 'default'fordm-cacheor an empty string--cachesettings ''fordm-writecache. Seelvmcache(7)for more ๐ฆ--cachesizeSize[m|UNIT]โ the size of cache to use.--cachevolLV โ the name of a cache volume.-c|--chunksizeSize[k|UNIT]โ the size of chunks in a snapshot, cache pool or thin pool. And the rules differ per thing, so listen up:- snapshots: the value must be a power of 2 between
4 KiBand512 KiB, and the default is4 - cache pool: the value must be between
32 KiBand1 GiB, and the default is64 - thin pool: the value must be between
64 KiBand1 GiB, and the default starts at64and scales up to fit the pool metadata size within128 MiBโ but only if the pool metadata size was not specified - either way the value must be a multiple of
64 KiB
- snapshots: the value must be a power of 2 between
See lvmthin(7) and lvmcache(7) for more ๐
--commandprofileString โ the command profile to use for command configuration. Seelvm.conf(5)for more about profiles.--compressiony|nโ controls whether compression is enabled or disabled for a VDO volume. Seelvmvdo(7)for more about VDO usage ๐--configString โ config settings for the command. These overridelvm.conf(5)settings. The String arg uses the same format aslvm.conf(5), or it can usesection/fieldsyntax. Seelvm.conf(5)for more about config โจ-C|--contiguousy|nโ sets or resets the contiguous allocation policy for LVs. Default is no contiguous allocation, based on a next free principle. And heads up: you can only flip a non-contiguous allocation policy to contiguous if all of the allocated physical extents in the LV are already 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 configured) ๐--deduplicationy|nโ controls whether deduplication is enabled or disabled for a VDO volume. Seelvmvdo(7)for more about VDO usage.--devicesPV โ restricts the devices that are visible and accessible to the command. Devices not listed will appear to be missing ๐ป This option can be repeated, or it accepts a comma-separated list of devices. This overrides the devices file.--devicesfileString โ a file listing devices that LVM should use. The file must exist in/etc/lvm/devices/and is managed with thelvmdevices(8)command. This overrides thelvm.conf(5)devices/devicesfileanddevices/use_devicesfilesettings ๐--discardspassdown|nopassdown|ignoreโ specifies how the device-mapper thin pool layer in the kernel should handle discards:ignoreโ the thin pool just ignores discardsnopassdownโ the thin pool processes discards itself, so unneeded extents in the thin pool can be reusedpassdownโ the thin pool processes discards itself (likenopassdown) and passes the discards down to the underlying device
See lvmthin(7) for more ๐ธ
--driverloadedy|nโ if set to no, the command will not attempt to use device-mapper. For testing and debugging ๐ง--errorwhenfully|nโ specifies thin pool behavior when data space runs out. Whenyes, device-mapper will immediately return an error when a thin pool is full and an I/O request needs space. Whenno, device-mapper will queue those I/O requests for a while to give the thin pool a chance to be extended โ and errors get returned if no space is available after the timeout. (Also see the"dm_thin_pool"kernel module optionno_space_timeout.) Seelvmthin(7)for more ๐-l|--extentsNumber[PERCENT]โ specifies the size of the new LV in logical extents. The--sizeand--extentsoptions are alternate methods of specifying size. Oh and the total number of physical extents used will be greater when redundant data is needed for RAID levels, jsyk. There's also an alternate syntax that lets the size be determined indirectly as a percentage of the size of a related VG, LV, or set of PVs:%VGโ the total size of the VG%FREEโ the remaining free space in the VG%PVSโ the free space in the specified PVs- for a snapshot, the size can be expressed as a percentage of the total size of the origin LV with
%ORIGIN(100%ORIGINprovides space for the whole origin)
When expressed as a percentage, the size defines an upper limit for the number of logical extents in the new LV. The precise number of logical extents in the new LV is not determined until the command has completed โ so don't come for me, it's just how it is bestie ๐
-h|--helpโ display help text ๐ซถ-K|--ignoreactivationskipโ ignore the"activation skip"LV flag during activation, so LVs that have the flag set can still be activated โจ--ignoremonitoringโ do not interact withdmeventdunless--monitoris specified. And fr, do not use this ifdmeventdis already monitoring a device โ ๏ธ--integritysettingsString โ specifies tunable kernel options fordm-integrity. Seelvmraid(7)for more.--journalString โ record information in the systemd journal. This information is in addition to the info enabled by thelvm.conflog/journalsetting:commandโ record information about the commandoutputโ record the default command outputdebugโ record full command debugging ๐
--lockoptString โ used to pass options for special cases tolvmlockd. Seelvmlockd(8)for more.--longhelpโ display long help text ๐-j|--majorNumber โ sets the major number of an LV block device.--[raid]maxrecoveryrateSize[k|UNIT]โ 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 to0means it will be unbounded. Seelvmraid(7)for more ๐ฅ--metadataprofileString โ the metadata profile to use for command configuration. Seelvm.conf(5)for more about profiles.--minorNumber โ sets the minor number of an LV block device.--[raid]minrecoveryrateSize[k|UNIT]โ 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 to0means it will be unbounded. Seelvmraid(7)for more ๐--mirrorlogcore|diskโ specifies the type of mirror log for LVs with the"mirror"type (does not apply to the"raid1"type, ok?). Let's go:diskโ a persistent log, and it needs a small amount of storage space, usually on a separate device from the data being mirroredcoreโ not persistent; the log lives only in memory. In this case the mirror must be synchronized (by copying LV data from the first device to the others) every single time the LV is activated, e.g. after a reboot ๐ญmirroredโ a persistent log that is itself mirrored, but bestie, avoid this one. Instead, use theraid1type for log redundancy ๐
-m,--mirrorsNumber โ how many mirror images you want on top of the original LV image. So like,--mirrors 1means there's two copies of the data total: the og plus one mirror ๐. Optional positional PV args on the command line can say which devices the images should live on. There's two whole mirroring implementations, bestie:"raid1"and"mirror"(these are the LV type names, aka "segment types"). Use--typeto pick which one โraid1is the default,mirroris legacy. Configure the defaults withlvm.conf(5)global/mirror_segtype_defaultandglobal/raid10_segtype_default. Want to skip that initial image synchronization? That's the--nosyncoption โจ. More info inlvmraid(7).--monitor y|nโ start (yes) or stop (no) monitoring an LV withdmeventd.dmeventdwatches kernel events for an LV and does automated maintenance on it when specific events happen. Go readdmeventd(8)for the deets ๐-n,--nameString โ the name of your shiny new LV ๐. If you don't say anything, it just generates a default name of"lvol#", where#is some number LVM comes up with.--nohintsโ don't use the hints file to find devices for PVs. Fair warning: without hints, a command might read more devices while hunting for PVs ๐. It still does the standard hint file invalidation where appropriate, so it's not fully feral.--nolockingโ turns locking off entirely. Use with caution, bestie, because concurrent commands can produce incorrect results ๐. Like, actually incorrect.--nosyncโ makes creating mirror, raid1, raid4, raid5 and raid10 skip the initial synchronization. For mirror, raid1 and raid10, anything written after will still be mirrored, but the original contents do NOT get copied. For raid4 and raid5, no parity blocks get written, though any data written afterwards will cause parity blocks to be stored. This is genuinely useful for skipping a potentially long and resource-intensive initial sync of an empty mirror/raid1/raid4/raid5 and raid10 LV ๐ซถ. Heads up though: this option is not valid for raid6, because raid6 relies on proper parity (P and Q Syndromes) being created during initial synchronization to reconstruct proper user data in case of device failures. And raid0 and raid0_meta don't provide any data copies or parity support at all, so they just don't support initial synchronization. Periodt.--noudevsyncโ disables udev synchronization. The process won't wait for a notification from udev, it'll just keep going no matter what udev might be doing in the background ๐. Only use this if udev isn't running, or has rules that ignore the devices LVM creates.-p,--permission rw|rโ set access permission to read only (r) or read and write (rw).-M,--persistent y|nโ whenyes, makes that specified minor number persistent โจ.--pooldatavdo y|nโ use a VDO type volume for the pool data volume.--poolmetadatasize Size[m|UNIT]โ specifies the size of the new pool metadata LV.--poolmetadataspare y|nโ enable or disable the automatic creation and management of a spare pool metadata LV in the VG. A spare metadata LV is reserved space that's there for you when repairing a pool ๐ .--profileString โ an alias for--commandprofileor--metadataprofile, depending on the command.-q,--quiet ...โ suppress output and log messages. It overrides--debugand--verbose. Repeat it once and it also suppresses any prompts with answer'no'๐คซ.--raidintegrity y|nโ enable or disable data integrity checksums for raid images.--raidintegrityblocksizeNumber โ the block size to use for dm-integrity on raid images. The integrity block size should usually match the device logical block size, or the file system block size. It may be less than the file system block size, but never less than the device logical block size. Possible values:512,1024,2048,4096.--raidintegritymodeString โ use a journal (default) or bitmap for keeping integrity checksums consistent in case of a crash. The bitmap areas get recalculated after a crash, so corruption in those areas would not be detected ๐ญ. A journal doesn't have this problem. Journal mode doubles writes to storage, but can improve performance for scattered writes packed into a single journal write. Bitmap mode can in theory achieve full write throughput of the device, but wouldn't benefit from that potential scattered write optimization.-r,--readahead auto|none|Numberโ sets the read ahead sector count of an LV.autois the default, which lets the kernel choose a suitable value automatically.noneis equivalent to zero.-R,--regionsize Size[m|UNIT]โ size of each raid or mirror synchronization region.lvm.conf(5)activation/raid_region_sizecan set a default.--reportformat basic|json|json_stdโ overrides the current output format for reports, which is normally defined globally by thereport/output_formatsetting inlvm.conf(5).basicis the original format with columns and rows. If there's more than one report per command, each report gets prefixed with the report name for identification.jsonproduces report output in JSON format.json_stdproduces report output in JSON format that's more compliant with the JSON standard โจ. Seelvmreport(7)for more.-k,--setactivationskip y|nโ persistently sets (yes) or clears (no) the"activation skip"flag on an LV. An LV with this flag set won't be activated unless the--ignoreactivationskipoption 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 shows up in thelvslv_attrbits.--setautoactivation y|nโ set the autoactivation property on a VG or LV. Display the property withvgsorlvs"-o autoactivation". When autoactivation is disabled, the VG or LV won't be activated by a command doing autoactivation (vgchange,lvchange, orpvscanusing-aay.) If autoactivation is disabled on a VG, no LVs will be autoactivated in that VG, and the LV autoactivation property has no effect. If autoactivation is enabled on a VG, you can still disable autoactivation for individual LVs ๐-L,--size Size[m|UNIT]โ specifies the size of the new LV. The--sizeand--extentsoptions are alternate methods of specifying size. And ngl, the total number of physical extents used will be greater when redundant data is needed for RAID levels.-s,--snapshotโ create a snapshot. Snapshots give you a "frozen image" of an origin LV ๐ธ. The snapshot LV can be used, like, for backups, while the origin LV keeps doing its thing. This option can create a COW (copy on write) snapshot, or a thin snapshot (in a thin pool.)
Thin snapshots are created when the origin is a thin LV and the size option is NOT specified. Thin snapshots share the same blocks in the thin pool, and do not allocate new space from the VG. They're created with the "activation skip" flag โ see --setactivationskip.
A thin snapshot of a non-thin "external origin" LV gets created when a thin pool is specified. 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 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 happen to the origin or snapshot. The size you pick should depend on the number of writes you expect; often 20% of the origin LV is enough. If COW space runs low, you can extend it with lvextend (shrinking is also allowed with lvreduce.) A small amount of the COW snapshot LV size is used to track COW block locations, so the full size is not available for COW data blocks. Use lvs to check how much space is used, and see --monitor to automatically extend the size so you don't run out ๐ฑ.
-i,--stripesNumber โ the number of stripes in a striped LV. This is the number of PVs (devices) that a striped LV is spread across. Data that looks sequential in the LV gets spread across multiple devices in units of the stripe size (see--stripesize). This doesn't change existing allocated space, 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 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 too (raid0: 2,raid10: 2,raid4/5: 3,raid6: 5.) To stripe a new raid LV across all PVs by default, seelvm.conf(5)allocation/raid_stripe_all_devices๐-I,--stripesize Size[k|UNIT]โ the amount of data written to one device before moving on to the next in a striped LV.-t,--testโ run in test mode. Commands will not update metadata ๐. This is implemented by disabling all metadata writing but still returning success to the calling function. So yeah, this may lead to unusual error messages in multi-stage operations if a tool relies on reading back metadata it believes has changed but actually hasn't ๐.-T,--thinโ says the command is handling a thin LV or thin pool. See--type thin,--type thin-pool, and--virtualsize. Seelvmthin(7)for more about LVM thin provisioning โจ--thinpoolLV โ the name of a thin pool LV.--type linear|striped|snapshot|raid|mirror|thin|thin-pool|vdo|vdo-pool|cache|cache-pool|writecacheโ bestie this is THE LV type, aka the "segment type" or "segtype" ๐ and the ways you actually use each one are laid out in the usage descriptions. Want the tea on redundancy and performance (raid<N>,mirror,striped,linear)? That's over inlvmraid(7). Thin provisioning (thin,thin-pool) lives inlvmthin(7). Performance caching (cache,cache-pool) is inlvmcache(7). Copy-on-write snapshots (snapshot) are in the usage definitions. And VDO (vdo) is inlvmvdo(7). Now listen โ several commands just skip the explicit type option altogether because the type gets inferred from other options or shortcuts (like--stripes,--mirrors,--snapshot,--virtualsize,--thin,--cache,--vdo). Use inferred types with care, ok?? Because it can give you unexpected results ๐ญ๐--vdoโ says hey, this command is handling a VDO LV. Peep--type vdo. Andlvmvdo(7)has all the VDO usage deets ๐--vdopoolLV โ the name of the VDO pool LV ๐ซถ catchlvmvdo(7)for more VDO tea.--vdosettingsString โ the tunable VDO options for your VDO LVs โจ form it likeoption=valueoroption1=value option2=value, or just repeat--vdosettingsonce per option you're setting. These settings override the default VDO behaviors. Wanna wipe your vdosettings and go back to those defaults? Use--vdosettings 'default'. More inlvmvdo(7)๐-v,--verboseโ turns up the verbose level. Repeat it 1 to 4 times to crank the detail of messages going to stdout and stderr ๐ข every repeat = more detail.--versionโ shows you the version info, periodt ๐-V,--virtualsizeSize[m|UNIT] โ the virtual size of a shiny new thin LV ๐ธlvmthin(7)has the full thin-provisioning story. Heads up: using virtual size (-V) together with actual size (-L) creates a sparse LV. Andlvm.conf(5)global/sparse_segtype_defaultdecides which default segment type gets used to make that sparse LV. Anything you write to a sparse LV comes right back when you read it โ iconic ๐ everything else you read from the LV returns blocks of zeros. And when you use a snapshot to create a sparse LV, a hidden virtual device gets created using the zero target, and the LV has the suffix_vorigin. Just so you know, snapshots are less efficient than thin provisioning when you're making large sparse LVs (GiB) ๐-W,--wipesignatures y|nโ controls detection and then the actual wiping of signatures on new LVs ๐งฝ Every signature it detects comes with a prompt to confirm the wipe (unless you use--yesto override the confirmations, miss bossy). If you don't specify it, signatures get wiped whenever zeroing is done (see--zero) โ and you can configure that behavior withlvm.conf(5)allocation/wipe_signatures_when_zeroing_new_lvs. If blkid wiping is on (that'slvm.conf(5)allocation/use_blkid_wiping) and LVM is compiled with blkid wiping support, then theblkid(8)library does the detecting (runblkid -kto list the signatures it recognizes). Otherwise the native LVM code is used to detect signatures โ and heads up, in that case only MD RAID, swap and LUKS signatures get detected. Oh and the LV is not wiped if the read only flag is set ๐ซ-y,--yesโ no interactive confirmation prompts, it just always assumes the answer is yes. Use with extreme caution โ ๏ธ for real, be careful with this one. (Want automatic no? See-qq.)-Z,--zero y|nโ controls zeroing of the first 4 KiB of data in the new LV. Default isy. Snapshot COW volumes are always zeroed, no negotiating ๐ For thin pools, this controls zeroing of provisioned blocks. The LV is not zeroed if the read only flag is set. Warning: trying to mount an unzeroed LV can cause the system to hang ๐ญ don't do it bestie.
โจ VARIABLES โจ
๐ VG
Volume Group name ๐ peep lvm(8) for what counts as a valid name. And for lvcreate specifically, the required VG positional arg can be omitted when the VG name is tucked inside another option, e.g. --name VG/LV โจ
๐ LV
Logical Volume name ๐ธ lvm(8) has the valid names. An LV positional arg generally includes the VG name and the LV name, e.g. VG/LV. And LV1 means the LV has to be a specific type โ the accepted LV types are listed wherever you see it. (raid represents the raid<N> type.)
๐ PV
Physical Volume name, a device path under /dev ๐ซถ For commands that manage physical extents, a PV positional arg generally accepts a suffix indicating a range (or multiple ranges) of physical extents (PEs). If you leave off the first PE it defaults to the start of the device, and if you leave off the last PE it defaults to the end. So:
- Start and end range (inclusive):
PV[:PE-PE]... - Start and length range (counting from 0):
PV[:PE+PE]...
๐ String
See the option description for what the string should contain ๐
๐ Size[UNIT]
Size is an input number that accepts an optional unit. By the way, input units are always treated as base two values, no matter the capitalization โ so 'k' and 'K' both mean 1024, cute right? The default input unit is specified by letter, followed by |UNIT. And 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. โ ๏ธ Do NOT confuse this with the output control --units, where capital letters mean a multiple of 1000 โ totally different vibe, iykyk ๐
๐ ENVIRONMENT VARIABLES ๐
Peep lvm(8) for the info on environment variables used by lvm โจ For example, LVM_VG_NAME can generally be substituted for a required VG parameter, which is lowkey so convenient ๐
๐ ADVANCED USAGE ๐
Alternate command forms, advanced command usage, and a listing of all valid syntax for completeness ๐ buckle up bestie.
Create an LV that returns errors when used.
lvcreate --type error -L|--size Size[m|UNIT] VG
[ -l|--extents Number[PERCENT] ]
[ COMMON_OPTIONS ]
Create an LV that returns zeros when read.
lvcreate --type zero -L|--size Size[m|UNIT] VG
[ -l|--extents Number[PERCENT] ]
[ COMMON_OPTIONS ]
Create a linear LV.
lvcreate --type linear -L|--size Size[m|UNIT] VG
[ -l|--extents Number[PERCENT] ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a striped LV (also see lvcreate --stripes).
lvcreate --type striped -L|--size Size[m|UNIT] VG
[ -l|--extents Number[PERCENT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a mirror LV (also see --type raid1).
lvcreate --type mirror -L|--size Size[m|UNIT] VG
[ -l|--extents Number[PERCENT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ -m|--mirrors Number ]
[ -R|--regionsize Size[m|UNIT] ]
[ --mirrorlog core|disk ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a COW snapshot LV of an origin LV (also see --snapshot).
lvcreate --type snapshot -L|--size Size[m|UNIT] LV
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ -s|--snapshot ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a sparse COW snapshot LV of a virtual origin LV (also see --snapshot).
lvcreate --type snapshot -L|--size Size[m|UNIT]
-V|--virtualsize Size[m|UNIT] VG
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -s|--snapshot ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a thin pool.
lvcreate -L|--size Size[m|UNIT] -T|--thin VG
[ --type thin-pool ] (implied)
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ --compression y|n ]
[ --deduplication y|n ]
[ --discards passdown|nopassdown|ignore ]
[ --errorwhenfull y|n ]
[ --pooldatavdo y|n ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ --vdosettings String ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a thin pool named in --thinpool.
lvcreate --thinpool LV_new -L|--size Size[m|UNIT] VG
[ --type thin-pool ] (implied)
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ -T|--thin ]
[ --compression y|n ]
[ --deduplication y|n ]
[ --discards passdown|nopassdown|ignore ]
[ --errorwhenfull y|n ]
[ --pooldatavdo y|n ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ --vdosettings String ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a cache pool named by the --cachepool arg (variant, uses --cachepool in place of --name).
lvcreate --cachepool LV_new --type cache-pool
-L|--size Size[m|UNIT] VG
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -H|--cache ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ --cachemetadataformat auto|1|2 ]
[ --cachemode writethrough|writeback|passthrough ]
[ --cachepolicy String ]
[ --cachesettings String ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ COMMON_OPTIONS ]
[ PV ... ]
Create a thin LV in a thin pool.
lvcreate --thinpool LV1 --type thin
-V|--virtualsize Size[m|UNIT] VG
[ -T|--thin ]
[ COMMON_OPTIONS ]
LV1 types: thinpool
Create a thin LV in a thin pool named in the first arg (variant, also see --thinpool for naming pool).
lvcreate --type thin -V|--virtualsize Size[m|UNIT] LV1
[ -T|--thin ]
[ COMMON_OPTIONS ]
LV1 types: thinpool
Create a thin LV in the thin pool named in the first arg (also see --thinpool for naming pool.)
lvcreate -V|--virtualsize Size[m|UNIT] LV1
[ --type thin ] (implied)
[ -T|--thin ]
[ COMMON_OPTIONS ]
LV1 types: thinpool
Create a thin LV that is a snapshot of an existing thin LV.
lvcreate --type thin LV1
[ -s|--snapshot ]
[ -T|--thin ]
[ COMMON_OPTIONS ]
LV1 types: thin
okay so bestie, we're deep in the example buffet now and it's still going, and honestly? iconic. ๐
Make a thin LV that is a snapshot of an existing thin LV.
lvcreate -T|--thin LV1
[ --type thin ] (implied)
[ -s|--snapshot ]
[ COMMON_OPTIONS ]
LV1 types: thin
Make a thin LV that is a snapshot of an external origin LV.
lvcreate --thinpool LV1 -s|--snapshot LV
[ --type thin ] (implied)
[ COMMON_OPTIONS ]
LV1 types: thinpool
Make a VDO LV that comes with its own VDO pool.
lvcreate --vdo -L|--size Size[m|UNIT] VG
[ --type vdo ] (implied)
[ -l|--extents Number[PERCENT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ -V|--virtualsize Size[m|UNIT] ]
[ --compression y|n ]
[ --deduplication y|n ]
[ --vdopool LV ]
[ --vdosettings String ]
[ COMMON_OPTIONS ]
[ PV ... ]
Same energy, same VDO pool, but you're naming the pool yourself.
lvcreate --vdopool LV_new -L|--size Size[m|UNIT] VG
[ --type vdo ] (implied)
[ -l|--extents Number[PERCENT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ -V|--virtualsize Size[m|UNIT] ]
[ --compression y|n ]
[ --deduplication y|n ]
[ --vdosettings String ]
[ COMMON_OPTIONS ]
[ PV ... ]
Make a thin LV, and while we're at it, make the thin pool it lives in โ the pool gets its name from the --thinpool arg.
lvcreate --thinpool LV_new --type thin
-L|--size Size[m|UNIT] -V|--virtualsize Size[m|UNIT] VG
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ -T|--thin ]
[ --compression y|n ]
[ --deduplication y|n ]
[ --discards passdown|nopassdown|ignore ]
[ --errorwhenfull y|n ]
[ --pooldatavdo y|n ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ --vdosettings String ]
[ COMMON_OPTIONS ]
[ PV ... ]
Same thing, but you let --type thin be implied instead of typing it out. we love a low-effort moment.
lvcreate --thinpool LV_new -L|--size Size[m|UNIT]
-V|--virtualsize Size[m|UNIT] VG
[ --type thin ] (implied)
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ -T|--thin ]
[ --compression y|n ]
[ --deduplication y|n ]
[ --discards passdown|nopassdown|ignore ]
[ --errorwhenfull y|n ]
[ --pooldatavdo y|n ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ --vdosettings String ]
[ COMMON_OPTIONS ]
[ PV ... ]
Make a thin LV plus its very own thin pool โ where the new pool name comes from the first arg, or the pool name just gets generated for you when that first arg is a VG name.
lvcreate --type thin -L|--size Size[m|UNIT]
-V|--virtualsize Size[m|UNIT] VG|LV_new
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ -T|--thin ]
[ --compression y|n ]
[ --deduplication y|n ]
[ --discards passdown|nopassdown|ignore ]
[ --errorwhenfull y|n ]
[ --pooldatavdo y|n ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ --vdosettings String ]
[ COMMON_OPTIONS ]
[ PV ... ]
And the -T|--thin version of exactly that, with --type thin implied because we're chill like that.
lvcreate -L|--size Size[m|UNIT] -T|--thin
-V|--virtualsize Size[m|UNIT] VG|LV_new
[ --type thin ] (implied)
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ --compression y|n ]
[ --deduplication y|n ]
[ --discards passdown|nopassdown|ignore ]
[ --errorwhenfull y|n ]
[ --pooldatavdo y|n ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ --vdosettings String ]
[ COMMON_OPTIONS ]
[ PV ... ]
okay this next one is the spicy one ๐ซถ โ it creates a thin LV, first creating a thin pool for it, and creates a sparse snapshot of a virtual origin LV. Which type you get โthinorsnapshotโ is chosen according to the config settingsparse_segtype_default. so like, the config is the one deciding your fate here, not you. iykyk.
lvcreate -L|--size Size[m|UNIT] -V|--virtualsize Size[m|UNIT] VG
[ --type thin|snapshot ] (implied)
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ -s|--snapshot ]
[ -T|--thin ]
[ --compression y|n ]
[ --deduplication y|n ]
[ --discards passdown|nopassdown|ignore ]
[ --errorwhenfull y|n ]
[ --pooldatavdo y|n ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ --vdosettings String ]
[ COMMON_OPTIONS ]
[ PV ... ]
oooo now we're in cache territory โจ๐ธ
Make a new LV, then attach the cachepool you specified โ which converts the new LV to type cache.
lvcreate --cachepool LV1 -L|--size Size[m|UNIT] VG
[ --type cache ] (implied)
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -H|--cache ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ --cachemetadataformat auto|1|2 ]
[ --cachemode writethrough|writeback|passthrough ]
[ --cachepolicy String ]
[ --cachesettings String ]
[ COMMON_OPTIONS ]
[ PV ... ]
LV1 types: cachepool
Make a new LV, then attach the cachepool โ converts the new LV to type cache all over again. this is the variant where you also use --cachepool. ๐
lvcreate --type cache -L|--size Size[m|UNIT] LV1
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -H|--cache ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ --cachemetadataformat auto|1|2 ]
[ --cachemode writethrough|writeback|passthrough ]
[ --cachepolicy String ]
[ --cachesettings String ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ COMMON_OPTIONS ]
[ PV ... ]
LV1 types: cachepool
okay this last one has two whole modes depending on what your LV arg actually is, so read carefully bestie ๐
If the LV arg is a cachepool: then a new LV gets made and the cachepool arg gets attached to it. (this is the variant where you use --type cache and --cachepool.)
If the LV arg is not a cachepool: then a new cachepool gets made and gets attached to the LV arg. (this is the alternative โ use lvconvert.)
lvcreate -H|--cache -L|--size Size[m|UNIT] LV
[ --type cache ] (implied)
[ -l|--extents Number[PERCENT] ]
[ -c|--chunksize Size[k|UNIT] ]
[ -i|--stripes Number ]
[ -I|--stripesize Size[k|UNIT] ]
[ --cachemetadataformat auto|1|2 ]
[ --cachemode writethrough|writeback|passthrough ]
[ --cachepolicy String ]
[ --cachesettings String ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ COMMON_OPTIONS ]
[ PV ... ]
๐ธ EXAMPLES ๐ธ
okay bestie this is the part where it all comes together ๐ real commands, real vibes, copy-paste energy. every single one of these is verbatim, so don't get creative with them, okay? โจ
make a striped LV, 3 stripes, stripe size 8 KiB, size 100 MiB. the LV name? lvcreate picks it for you, main character behavior honestly ๐
lvcreate -i 3 -I 8 -L 100m vg00
make a raid1 LV with two images and a usable size of 500 MiB. this one needs two devices, one for each mirror image ๐ช and yes, RAID metadata (superblock and bitmap) also lives on those two devices, no cap.
lvcreate --type raid1 -m1 -L 500m -n mylv vg00
make a mirror LV with two images and a usable size of 500 MiB. this one takes three devices: two for the mirror images, one for a disk log ๐
lvcreate --type mirror -m1 -L 500m -n mylv vg00
make a mirror LV with 2 images and a usable size of 500 MiB, but only 2 devices this time because the log is in memory. lowkey efficient ๐
lvcreate --type mirror -m1 --mirrorlog core -L 500m -n mylv vg00
make a copy-on-write snapshot of an LV ๐ฆ
lvcreate --snapshot --size 100m --name mysnap vg00/mylv
make a copy-on-write snapshot with a size sufficient for overwriting 20% of the size of the original LV:
lvcreate -s -l 20%ORIGIN -n mysnap vg00/mylv
make a sparse LV with 1 TiB of virtual space, and actual space just under 100 MiB. it's giving illusion โจ
lvcreate --snapshot --virtualsize 1t --size 100m --name mylv vg00
make a linear LV with a usable size of 64 MiB on specific physical extents:
lvcreate -L 64m -n mylv vg00 /dev/sda:0-7 /dev/sdb:0-7
make a RAID5 LV with a usable size of 5 GiB, 3 stripes, a stripe size of 64 KiB, using a total of 4 devices (including one for parity):
lvcreate --type raid5 -L 5G -i 3 -I 64 -n mylv vg00
make a RAID5 LV using all of the free space in the VG and spanning all the PVs in the VG ๐ซถ
heads up bestie, this command will fail if there are more than 8 PVs in the VG ๐ญ in that case -i 7 must be used to get to the current maximum of 8 devices including parity for RAID LVs.
lvcreate --config allocation/raid_stripe_all_devices=1 --type raid5 -l 100%FREE -n mylv vg00
make a RAID10 LV with a usable size of 5 GiB, using 2 stripes, each on a two-image mirror.
note that the-iand-marguments behave differently:-ispecifies the total number of stripes, but-mspecifies the number of images in addition to the first image. okay? okay. ๐
lvcreate --type raid10 -L 5G -i 2 -m 1 -n mylv vg00
make a 1 TiB thin LV named mythin, with 256 GiB thinpool tpool0 in vg00:
lvcreate -T -V 1T --size 256G --name mythin vg00/tpool0
make a 1 TiB thin LV, first creating a new thin pool for it, where the thin pool has 100 MiB of space, uses 2 stripes, has a 64 KiB stripe size, and 256 KiB chunk size:
lvcreate --type thin --name mylv --thinpool mypool -V 1t -L 100m -i 2 -I 64 -c 256 vg00
make a thin snapshot of a thin LV ๐
the size option must not be used, otherwise a copy-on-write snapshot would be created instead. don't do it bestie.
lvcreate --snapshot --name mysnap vg00/thinvol
make 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/origin
make 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/fast1
make a cache LV: first create a new origin LV on a slow physical device, then combine the new origin LV with an existing cache pool ๐ขโก๏ธ๐
lvcreate --type cache --cachepool my_cpool -L 100G -n mylv vg00 /dev/slow1
make a VDO LV vdo0 with VDOPoolLV size of 10 GiB and name vpool1:
lvcreate --vdo --size 10G --name vdo0 vg00/vpool1
๐ SEE ALSO ๐
the whole friend group, fr fr ๐ go read these, they're iconic:
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)
and that's the whole page bestie, you made it to the end ๐ญ๐ this one is LVM TOOLS 2.03.44(2), dated 2026-10-27, and it's brought to you by Red Hat, Inc. โ go forth and create those logical volumes, you absolute icon ๐โจ
๐ฆ where this page comes from
- arch rolling: lvm2 2.03.44-1 ยท GPL-2.0-only AND LGPL-2.1-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms