2008-10-08 16:50:13 +04:00
.TH LVCREATE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
2002-01-04 23:35:19 +03:00
.SH NAME
lvcreate \- create a logical volume in an existing volume group
.SH SYNOPSIS
.B lvcreate
2014-10-07 16:48:38 +04:00
.RB [ \- a | \- \- activate
.RI [ a | e | l ]{ y | n }]
2011-10-19 20:49:13 +04:00
.RB [ \- \- addtag
.IR Tag ]
.RB [ \- \- alloc
.IR AllocationPolicy ]
.RB [ \- A | \- \- autobackup
.RI { y | n }]
2014-10-07 16:48:38 +04:00
.RB [ \- H | \- \- cache ]
.RB [ \- \- cachemode
.RI { writeback | writethrough }]
.RB [ \- \- cachepool
.IR CachePoolLogicalVolume { Name | Path }
.RB [ \- c | \- \- chunksize
.IR ChunkSize [ bBsSkKmMgG ]]
2014-05-21 16:53:56 +04:00
.RB [ \- \- commandprofile
.IR ProfileName ]
2011-10-19 20:49:13 +04:00
.RB [ \- C | \- \- contiguous
.RI { y | n }]
.RB [ \- d | \- \- debug ]
2014-10-07 16:48:38 +04:00
.RB [ \- \- discards
.RI { ignore | nopassdown | passdown }]
.RB [{ \- l | \- \- extents
.IR LogicalExtentsNumber [ % { FREE | PVS | VG }]
|
.BR \- L | \- \- size
.IR LogicalVolumeSize [ bBsSkKmMgGtTpPeE ]}
2011-10-19 20:49:13 +04:00
.RB [ \- i | \- \- stripes
.IR Stripes
.RB [ \- I | \- \- stripesize
2014-10-07 16:48:38 +04:00
.IR StripeSize ]]]
.RB [ \- h | \- ? | \- \- help ]
.RB [ \- K | \- \- ignoreactivationskip ]
.RB [ \- \- ignoremonitoring ]
2011-10-19 20:49:13 +04:00
.RB [ \- \- minor
2014-10-07 16:48:38 +04:00
.IR minor
.RB [ \- j | \- \- major
2014-09-19 16:53:14 +04:00
.IR major ]]
2014-10-07 16:48:38 +04:00
.RB [ \- \- metadataprofile
.IR ProfileName ]
2011-10-19 20:49:13 +04:00
.RB [ \- m | \- \- mirrors
.IR Mirrors
2014-10-07 16:48:38 +04:00
.RB [{ \- \- corelog
2011-10-19 20:49:13 +04:00
|
2014-10-07 16:48:38 +04:00
.B \- \- mirrorlog
.RI { disk | core | mirrored }}]
.RB [ \- \- nosync ]
2011-10-19 20:49:13 +04:00
.RB [ \- R | \- \- regionsize
2014-10-07 16:48:38 +04:00
.IR MirrorLogRegionSize [ bBsSkKmMgG ]]]
.RB [ \- \- monitor
.RI { y | n }]
2011-10-19 20:49:13 +04:00
.RB [ \- n | \- \- name
2011-11-08 16:12:31 +04:00
.IR LogicalVolume { Name | Path }]
2014-10-07 16:48:38 +04:00
.RB [ \- \- noudevsync ]
2011-10-19 20:49:13 +04:00
.RB [ \- p | \- \- permission
.RI { r | rw }]
2014-10-07 16:48:38 +04:00
.RB [ \- M | \- \- persistent
.RI { y | n }
.RB [ \- \- pooldatasize
.IR DataVolumeSize [ bBsSkKmMgGtTpPeE ]]
2011-11-10 16:41:39 +04:00
.RB [ \- \- poolmetadatasize
2013-06-25 15:34:31 +04:00
.IR MetadataVolumeSize [ bBsSkKmMgG ]]
.RB [ \- \- poolmetadataspare
2014-10-07 16:48:38 +04:00
.RI { y | n }]
.RB [ \- \- [ raid ] maxrecoveryrate
.IR Rate ]
.RB [ \- \- [ raid ] minrecoveryrate
.IR Rate ]
.RB [ \- r | \- \- readahead
.RI { ReadAheadSectors | auto | none }]
.RB [ \- k | \- \- setactivationskip
.RI { y | n }]
2013-04-05 14:56:19 +04:00
.RB [ \- s | \- \- snapshot
2014-10-07 16:48:38 +04:00
.RB [ \- V | \- \- virtualsize
.IR VirtualSize [ bBsSkKmMgGtTpPeE ]]
.RB [ \- t | \- \- test ]
.RB [ \- T | \- \- thin ]
.RB [ \- \- thinpool
.IR ThinPoolLogicalVolume { Name | Path }]
2011-10-19 20:49:13 +04:00
.RB [ \- \- type
.IR SegmentType ]
.RB [ \- v | \- \- verbose ]
2013-11-27 18:20:12 +04:00
.RB [ \- W | \- \- wipesignatures ]
2011-10-19 20:49:13 +04:00
.RB [ \- Z | \- \- zero
.RI { y | n }]
2014-10-07 16:48:38 +04:00
.RI [ VolumeGroup { Name | Path }
.RI [/\{ ExternalOrigin
|
.I Origin
|
.IR Pool } LogicalVolumeName ]
2014-06-11 13:06:30 +04:00
.RI [ PhysicalVolumePath [ :PE [ \- PE ]]...]
2002-01-04 23:35:19 +03:00
.B lvcreate
2011-11-10 16:41:39 +04:00
.RB [ \- l | \- \- extents
2014-10-07 16:48:38 +04:00
.IR LogicalExtentsNumber [ % { FREE | ORIGIN | PVS | VG }]
2011-10-19 20:49:13 +04:00
|
2014-10-07 16:48:38 +04:00
.BR \- L | \- \- size | \- \- pooldatasize
2011-11-10 16:41:39 +04:00
.IR LogicalVolumeSize [ bBsSkKmMgGtTpPeE ]]
2011-10-19 20:49:13 +04:00
.RB [ \- c | \- \- chunksize
2014-10-07 16:48:38 +04:00
.IR ChunkSize [ bBsSkKmMgG ]]
2014-05-21 16:53:56 +04:00
.RB [ \- \- commandprofile
.IR Profilename ]
2011-10-19 20:49:13 +04:00
.RB [ \- \- noudevsync ]
.RB [ \- \- ignoremonitoring ]
2014-05-21 16:53:56 +04:00
.RB [ \- \- metadataProfile
.IR ProfileName ]
2013-04-05 14:24:32 +04:00
.RB [ \- \- monitor
.RI { y | n }]
2011-10-19 20:49:13 +04:00
.RB [ \- n | \- \- name
2011-11-08 16:12:31 +04:00
.IR SnapshotLogicalVolume { Name | Path }]
2014-10-07 16:48:38 +04:00
.BR \- s | \- \- snapshot | \- H | \- \- cache
2012-01-20 14:50:39 +04:00
.RI {[ VolumeGroup { Name | Path }/] OriginalLogicalVolumeName
2011-10-19 20:49:13 +04:00
.BR \- V | \- \- virtualsize
2011-11-08 16:12:31 +04:00
.IR VirtualSize [ bBsSkKmMgGtTpPeE ]}
2011-10-19 20:49:13 +04:00
.br
2002-01-04 23:35:19 +03:00
.SH DESCRIPTION
2012-04-11 16:42:10 +04:00
lvcreate creates a new logical volume in a volume group (see
.BR vgcreate "(8), " vgchange (8))
by allocating logical extents from the free physical extent pool
2002-01-04 23:35:19 +03:00
of that volume group. If there are not enough free physical extents then
2012-04-11 16:42:10 +04:00
the volume group can be extended (see
.BR vgextend (8))
with other physical volumes or by reducing existing logical volumes
of this volume group in size (see
.BR lvreduce (8)).
If you specify one or more PhysicalVolumes, allocation of physical
2009-10-26 16:41:13 +03:00
extents will be restricted to these volumes.
.br
2002-01-04 23:35:19 +03:00
.br
2012-04-11 16:42:10 +04:00
The second form supports the creation of snapshot logical volumes which
2002-01-04 23:35:19 +03:00
keep the contents of the original logical volume for backup purposes.
.SH OPTIONS
2011-10-19 20:49:13 +04:00
See
.BR lvm (8)
for common options.
2002-01-04 23:35:19 +03:00
.TP
2012-06-29 14:40:26 +04:00
.IR \fB \- a ", " \fB \- \- activate " {" y | ay | n | ey | en | ly | ln }
2012-04-11 16:42:10 +04:00
Controls the availability of the Logical Volumes for immediate use after
2011-06-01 23:21:03 +04:00
the command finishes running.
2014-06-11 13:06:30 +04:00
By default, new Logical Volumes are activated (\fB \- a\fI y\fR ).
If it is possible technically, \fB \- a\fI n\fR will leave the new Logical
2014-10-07 16:48:38 +04:00
Volume inactive. But for example, snapshots of active origin can only be
created in the active state so \fB \- a\fI n\fR cannot be used with
\fB -\- type\fP \fI snapshot\fP . This does not apply to thin volume snapshots,
which are by default created with flag to skip their activation
(\fB -k\fP \fI y\fP ).
2013-04-05 14:24:32 +04:00
Normally the \fB \- \- zero\fP \fI n\fP argument has to be supplied too because
2012-04-11 16:42:10 +04:00
zeroing (the default behaviour) also requires activation.
2012-06-29 14:40:26 +04:00
If autoactivation option is used (\fB \- a\fI ay\fR ), the logical volume is
2013-04-05 14:24:32 +04:00
activated only if it matches an item in the
2014-10-30 21:44:42 +03:00
.IR activation / auto_activation_volume_list
2013-04-05 14:24:32 +04:00
set in \fB lvm.conf\fP (5).
2013-11-27 18:20:12 +04:00
For autoactivated logical volumes, \fB \- \- zero\fP \fI n\fP and
\fB \- \- wipesignatures\fP \fI n\fP is always assumed and it can't
be overridden. If the clustered locking is enabled,
2013-05-05 23:38:44 +04:00
\fB \- a\fI ey\fR will activate exclusively on one node and
.IR \fB \- a { a | l } y
will activate only on the local node.
2011-06-01 23:21:03 +04:00
.TP
2014-10-07 16:48:38 +04:00
.IR \fB \- H ", " \fB \- \- cache
Creates cache or cache pool logical volume or both.
Specifying the optional argument \fB \- \- size\fP will cause the creation of
the cache logical volume.
Specifying the optional argument \fB \- \- pooldatasize\fP will cause
the creation of the cache pool logical volume.
Specifying both arguments will cause the creation of cache with its
cache pool volume.
When the Volume group name is specified together with existing logical volume
name which is NOT a cache pool name, such volume is treaded
as cache origin volume and cache pool is created. In this case
the \fB \- \- size\fP is used to specify size of cache pool volume.
See \fB lvmcache\fP (7) for more info about caching support.
Note that the cache segment type requires a dm-cache kernel module version
1.3.0 or greater.
2014-02-12 20:29:07 +04:00
.TP
2014-04-08 00:20:27 +04:00
.IR \fB \- \- cachemode " {" writeback | writethrough }
2014-02-25 22:17:03 +04:00
Specifying a cache mode determines when the writes to a cache LV
are considered complete. When \fI writeback\fP is specified, a write is
considered complete as soon as it is stored in the cache pool LV.
If \fI writethough\fP is specified, a write is considered complete only
when it has been stored in the cache pool LV and on the origin LV.
While \fI writethrough\fP may be slower for writes, it is more
resilient if something should happen to a device associated with the
cache pool LV.
2014-10-07 16:48:38 +04:00
.TP
.IR \fB \- \- cachepool " " CachePoolLogicalVolume { Name | Path }
Specifies the name of cache pool volume name. The other way to specify pool name
is to append name to Volume group name argument.
2013-07-10 16:06:50 +04:00
.TP
2012-10-30 21:11:59 +04:00
.BR \- c ", " \- \- chunksize " " \fI ChunkSize [ \fI bBsSkKmMgG ]
2014-02-12 20:29:07 +04:00
Gives the size of chunk for snapshot, cache pool and thin pool logical volumes.
2013-04-05 14:24:32 +04:00
Default unit is in kilobytes.
.br
2014-10-07 16:48:38 +04:00
For \fI snapshots\fP the value must be power of 2 between 4KiB and 512KiB
and the default value is 4KiB.
2013-04-05 14:24:32 +04:00
.br
2014-10-07 16:48:38 +04:00
For \fI cache pools\fP the value must a multiple of 32KiB
between 32KiB and 1GiB. The default is 64KiB.
2014-02-12 20:29:07 +04:00
.br
2014-10-07 16:48:38 +04:00
For \fI thin pools\fP the value must be a multiple of 64KiB
between 64KiB and 1GiB.
Default value starts with 64KiB and grows up to
fit the pool metadata size within 128MiB,
2012-10-30 21:11:59 +04:00
if the pool metadata size is not specified.
2014-10-07 16:48:38 +04:00
See
.BR lvm.conf (5)
setting
.IR allocation / thin_pool_chunk_size_policy
to select different calculation policy.
Thin pool target version <1.4 requires this value to be a power of 2.
2013-04-05 14:24:32 +04:00
For target version <1.5 discard is not supported for non power of 2 values.
2002-01-04 23:35:19 +03:00
.TP
2011-10-19 20:49:13 +04:00
.BR \- C ", " \- \- contiguous " {" \fI y | \fI n }
2002-01-04 23:35:19 +03:00
Sets or resets the contiguous allocation policy for
logical volumes. Default is no contiguous allocation based
on a next free principle.
.TP
2014-10-07 16:48:38 +04:00
.BR \- \- corelog
This is shortcut for option \fB \- \- mirrorlog\fP \fI core\fP .
.TP
2012-08-08 00:24:41 +04:00
.BR \- \- discards " {" \fI ignore | \fI nopassdown | \fI passdown }
2013-04-05 14:24:32 +04:00
Sets discards behavior for thin pool.
2012-06-28 16:47:34 +04:00
Default is \fI passdown\fP .
.TP
2014-10-07 16:48:38 +04:00
.BR \- K ", " \- \- ignoreactivationskip
Ignore the flag to skip Logical Volumes during activation.
Use \fB \- \- setactivationskip\fP option to set or reset
activation skipping flag persistently for logical volume.
2002-01-04 23:35:19 +03:00
.TP
2013-04-05 14:24:32 +04:00
.B \- \- ignoremonitoring
Make no attempt to interact with dmeventd unless \fB \- \- monitor\fP
is specified.
.TP
2011-10-19 20:49:13 +04:00
.IR \fB \- l ", " \fB \- \- extents " " LogicalExtentsNumber [ % { VG | PVS | FREE | ORIGIN }]
2002-01-04 23:35:19 +03:00
Gives the number of logical extents to allocate for the new
2014-02-25 02:48:23 +04:00
logical volume. The total number of physical extents allocated will be
greater than this, for example, if the volume is mirrored.
2010-02-03 06:58:08 +03:00
The number can also be expressed as a percentage of the total space
2011-10-19 20:49:13 +04:00
in the Volume Group with the suffix \fI %VG\fR , as a percentage of the
remaining free space in the Volume Group with the suffix \fI %FREE\fR , as a
2010-02-03 06:58:08 +03:00
percentage of the remaining free space for the specified
2011-10-19 20:49:13 +04:00
PhysicalVolume(s) with the suffix \fI %PVS\fR , or (for a snapshot) as a
2010-02-03 06:58:08 +03:00
percentage of the total space in the Origin Logical Volume with the
2014-06-17 15:33:42 +04:00
suffix \fI %ORIGIN\fR (i.e. \fI 100%ORIGIN\fR provides space for the whole origin).
When expressed as a percentage, the number is treated
2014-02-25 02:48:23 +04:00
as an approximate upper limit for the total number of physical extents
to be allocated (including extents used by any mirrors, for example).
2002-01-04 23:35:19 +03:00
.TP
2014-10-07 16:48:38 +04:00
.BR \- j ", " \- \- major " " \fI major
Sets the major number.
Major numbers are not supported with pool volumes.
This option is supported only on older systems
(kernel version 2.4) and is ignored on modern Linux systems where major
numbers are dynamically assigned.
.TP
.BR \- \- metadataprofile " " \fI ProfileName
Uses and attaches the ProfileName configuration profile to the logical
volume metadata. Whenever the logical volume is processed next time,
the profile is automatically applied. If the volume group has another
profile attached, the logical volume profile is preferred.
See \fB lvm.conf\fP (5) for more information about \fB metadata profiles\fP .
.TP
.B \- \- minor \fI minor
Sets the minor number.
Minor numbers are not supported with pool volumes.
2002-01-04 23:35:19 +03:00
.TP
2011-10-19 20:49:13 +04:00
.BR \- m ", " \- \- mirrors " " \fI Mirrors
2013-04-05 14:24:32 +04:00
Creates a mirrored logical volume with \fI Mirrors\fP copies.
For example, specifying
2014-10-07 16:48:38 +04:00
.BI \- m\ 1
2013-04-05 14:24:32 +04:00
would result in a mirror with two-sides; that is,
a linear volume plus one copy.
2006-08-19 01:49:19 +04:00
2013-04-05 14:24:32 +04:00
Specifying the optional argument \fB \- \- nosync\fP will cause the creation
2006-08-19 01:49:19 +04:00
of the mirror to skip the initial resynchronization. Any data written
afterwards will be mirrored, but the original contents will not be
copied. This is useful for skipping a potentially long and resource
2007-08-25 01:01:52 +04:00
intensive initial sync of an empty device.
2006-08-19 01:49:19 +04:00
2013-08-06 23:13:55 +04:00
There are two implementations of mirroring which can be used and correspond
2014-10-07 16:48:38 +04:00
to the "\fI raid1\fP " and "\fI mirror\fP " segment types.
The default is "\fI raid1\fP ". See the
2013-08-06 23:13:55 +04:00
\fB \- \- type\fP option for more information if you would like to use the
2014-10-07 16:48:38 +04:00
legacy "\fI mirror\fP " segment type. See
.BR lvm.conf (5)
settings
2014-10-30 21:44:42 +03:00
.IR global / mirror_segtype_default
and
.IR global / raid10_segtype_default
2014-10-07 16:48:38 +04:00
to configure default mirror segment type.
The options
\fB \- \- mirrorlog\fP and \fB \- \- corelog\fP apply
to the legacy "\fI mirror\fP " segment type only.
.TP
.BR \- \- mirrorlog " {" \fI disk | \fI core | \fI mirrored }
Specifies the type of log to be used for logical volumes utilizing
the legacy "\fI mirror\fP " segment type.
.br
2013-04-05 14:24:32 +04:00
The default is \fI disk\fP , which is persistent and requires
2007-08-25 01:01:52 +04:00
a small amount of storage space, usually on a separate device from the
2014-10-07 16:48:38 +04:00
data being mirrored.
.br
Using \fI core\fP means the mirror is regenerated by copying the data
from the first device each time the logical volume is activated,
like after every reboot.
.br
Using \fI mirrored\fP will create a persistent log that is itself mirrored.
2014-09-19 16:53:14 +04:00
.TP
2013-04-05 14:24:32 +04:00
.BR \- \- monitor " {" \fI y | \fI n }
Starts or avoids monitoring a mirrored, snapshot or thin pool logical volume with
dmeventd, if it is installed.
If a device used by a monitored mirror reports an I/O error,
the failure is handled according to
2014-10-30 21:44:42 +03:00
.IR activation / mirror_image_fault_policy
2013-04-05 14:24:32 +04:00
and
2014-10-30 21:44:42 +03:00
.IR activation / mirror_log_fault_policy
2013-04-05 14:24:32 +04:00
set in \fB lvm.conf\fP (5).
2006-08-19 01:49:19 +04:00
.TP
2011-11-08 16:12:31 +04:00
.IR \fB \- n ", " \fB \- \- name " " LogicalVolume { Name | Path }
2013-04-05 14:24:32 +04:00
Sets the name for the new logical volume.
2002-01-04 23:35:19 +03:00
.br
2013-04-05 14:24:32 +04:00
Without this option a default name of "lvol#" will be generated where
2002-01-04 23:35:19 +03:00
# is the LVM internal number of the logical volume.
.TP
2014-10-07 16:48:38 +04:00
.B \- \- nosync
Causes the creation of the mirror to skip the initial resynchronization.
2013-05-31 20:25:52 +04:00
.TP
2011-10-19 20:49:13 +04:00
.B \- \- noudevsync
2013-04-05 14:24:32 +04:00
Disables udev synchronisation. The
2009-08-04 12:09:52 +04:00
process will not wait for notification from udev.
It will continue irrespective of any possible udev processing
in the background. You should only use this if udev is not running
or has rules that ignore the devices LVM2 creates.
.TP
2011-10-19 20:49:13 +04:00
.BR \- p ", " \- \- permission " {" \fI r | \fI rw }
2013-04-05 14:24:32 +04:00
Sets access permissions to read only (\fI r\fP ) or read and write (\fI rw\fP ).
2002-01-04 23:35:19 +03:00
.br
Default is read and write.
2011-11-05 02:47:17 +04:00
.TP
2014-10-07 16:48:38 +04:00
.BR \- M ", " \- \- persistent " {" \fI y | \fI n }
Set to \fI y\fP to make the minor number specified persistent.
Pool volumes cannot have persistent major and minor numbers.
Defaults to \fI y\fP es only when major or minor number is specified.
Otherwise it is \fI n\fP o.
.TP
.IR \fB \- \- pooldatasize " " PoolDataVolumeSize [ bBsSkKmMgGtTpPeE ]
Sets the size of pool's data logical volume.
For thin pools you may also specify the size
with the option \fB \- \- size\fP .
.TP
2013-06-11 15:45:49 +04:00
.IR \fB \- \- poolmetadatasize " " MetadataVolumeSize [ bBsSkKmMgG ]
2014-10-07 16:48:38 +04:00
Sets the size of pool's metadata logical volume.
Supported values are in range between 2MiB and 16GiB for thin pool,
and upto 16GiB for cache pool. The minimum value is computed from pool's
data size.
Default value for thin pool is (Pool_LV_size / Pool_LV_chunk_size * 64b).
2011-11-07 14:59:55 +04:00
Default unit is megabytes.
2002-01-04 23:35:19 +03:00
.TP
2013-06-25 15:34:31 +04:00
.IR \fB \- \- poolmetadataspare " {" y | n }
Controls creation and maintanence of pool metadata spare logical volume
2014-07-22 19:31:22 +04:00
that will be used for automated pool recovery.
2013-06-25 15:34:31 +04:00
Only one such volume is maintained within a volume group
2014-07-22 19:31:22 +04:00
with the size of the biggest pool metadata volume.
2013-06-25 15:34:31 +04:00
Default is \fI y\fP es.
.TP
2014-10-07 16:48:38 +04:00
.BR \- \- [ raid ] maxrecoveryrate " " \fI Rate [ \fI bBsSkKmMgG ]
Sets the maximum recovery rate for a RAID logical volume. \fI Rate\fP
is specified as an amount per second for each device in the array.
If no suffix is given, then KiB/sec/device is assumed. Setting the
recovery rate to 0 means it will be unbounded.
.TP
.BR \- \- [ raid ] minrecoveryrate " " \fI Rate [ \fI bBsSkKmMgG ]
Sets the minimum recovery rate for a RAID logical volume. \fI Rate\fP
is specified as an amount per second for each device in the array.
If no suffix is given, then KiB/sec/device is assumed. Setting the
recovery rate to 0 means it will be unbounded.
.TP
2011-10-19 20:49:13 +04:00
.IR \fB \- r ", " \fB \- \- readahead " {" ReadAheadSectors | auto | none }
2013-04-05 14:24:32 +04:00
Sets read ahead sector count of this logical volume.
2007-11-09 19:51:54 +03:00
For volume groups with metadata in lvm1 format, this must
be a value between 2 and 120.
2013-04-05 14:24:32 +04:00
The default value is \fI auto\fP which allows the kernel to choose
2007-11-09 19:51:54 +03:00
a suitable value automatically.
2013-04-05 14:24:32 +04:00
\fI None\fP is equivalent to specifying zero.
2002-01-04 23:35:19 +03:00
.TP
2014-10-07 16:48:38 +04:00
.BR \- R ", " \- \- regionsize " " \fI MirrorLogRegionSize [ \fI bBsSkKmMgG ]
2013-04-05 14:24:32 +04:00
A mirror is divided into regions of this size (in MiB), and the mirror log
2006-04-28 17:11:05 +04:00
uses this granularity to track which regions are in sync.
.TP
2014-10-07 16:48:38 +04:00
.IR \fB \- k ", " \fB \- \- setactivationskip " {" y | n }
Controls whether Logical Volumes are persistently flagged to be skipped during
activation. By default, thin snapshot volumes are flagged for activation skip.
See
.BR lvm.conf (5)
.IR activation / auto_set_activation_skip
how to change its default behaviour.
To activate such volumes, an extra
.BR \- K | \- \- ignoreactivationskip
option must be used. The flag is not applied during deactivation. Use
.B lvchange \- \- setactivationskip {y|n}
command to change the skip flag for existing volumes.
To see whether the flag is attached, use \fB lvs\fP command
where the state of the flag is reported within \fB lv_attr\fP bits.
.TP
.IR \fB \- L ", " \fB \- \- size " " LogicalVolumeSize [ bBsSkKmMgGtTpPeE ]
Gives the size to allocate for the new logical volume.
A size suffix of \fI B\fR for bytes, \fI S\fR for sectors as 512 bytes,
\fI K\fR for kilobytes, \fI M\fR for megabytes,
\fI G\fR for gigabytes, \fI T\fR for terabytes, \fI P\fR for petabytes
or \fI E\fR for exabytes is optional.
.br
Default unit is megabytes.
.TP
2012-01-20 14:50:39 +04:00
.IR \fB \- s ", " \fB \- \- snapshot " " OriginalLogicalVolume { Name | Path }
2013-04-05 14:24:32 +04:00
Creates a snapshot logical volume (or snapshot) for an existing, so called
2002-01-04 23:35:19 +03:00
original logical volume (or origin).
Snapshots provide a 'frozen image' of the contents of the origin
while the origin can still be updated. They enable consistent
2012-01-20 14:50:39 +04:00
backups and online recovery of removed/overwritten data/files.
2014-10-07 16:48:38 +04:00
.br
2012-01-20 14:50:39 +04:00
Thin snapshot is created when the origin is a thin volume and
2013-07-15 13:52:05 +04:00
the size IS NOT specified. Thin snapshot shares same blocks within
2012-01-20 14:50:39 +04:00
the thin pool volume.
2013-07-15 13:52:05 +04:00
The non thin volume snapshot with the specified size does not need
the same amount of storage the origin has. In a typical scenario,
15-20% might be enough. In case the snapshot runs out of storage, use
2011-10-19 20:49:13 +04:00
.BR lvextend (8)
2002-01-04 23:35:19 +03:00
to grow it. Shrinking a snapshot is supported by
2011-10-19 20:49:13 +04:00
.BR lvreduce (8)
2002-01-04 23:35:19 +03:00
as well. Run
2013-04-05 14:24:32 +04:00
.BR lvs (8)
2002-01-04 23:35:19 +03:00
on the snapshot in order to check how much data is allocated to it.
2013-04-05 14:24:32 +04:00
Note: a small amount of the space you allocate to the snapshot is
2009-04-30 00:14:21 +04:00
used to track the locations of the chunks of data, so you should
2013-04-05 14:24:32 +04:00
allocate slightly more space than you actually need and monitor
(\fB \- \- monitor\fP ) the rate at which the snapshot data is growing
so you can \fB avoid\fP running out of space.
2013-04-05 14:56:19 +04:00
If \fB \- \- thinpool\fP is specified, thin volume is created that will
use given original logical volume as an external origin that
serves unprovisioned blocks.
Only read-only volumes can be used as external origins.
To make the volume external origin, lvm expects the volume to be inactive.
External origin volume can be used/shared for many thin volumes
even from different thin pools. See
.BR lvconvert (8)
for online conversion to thin volumes with external origin.
2009-04-25 05:17:59 +04:00
.TP
2014-10-07 16:48:38 +04:00
.BR \- i ", " \- \- stripes " " \fI Stripes
Gives the number of stripes.
This is equal to the number of physical volumes to scatter
the logical volume. When creating a RAID 4/5/6 logical volume,
the extra devices which are necessary for parity are
internally accounted for. Specifying
.BI \- i 3
would use 3 devices for striped logical volumes,
4 devices for RAID 4/5, and 5 devices for RAID 6. Alternatively,
RAID 4/5/6 will stripe across all PVs in the volume group or
all of the PVs specified if the
.B \- i
argument is omitted.
.TP
.BR \- I ", " \- \- stripesize " " \fI StripeSize
Gives the number of kilobytes for the granularity of the stripes.
.br
StripeSize must be 2^n (n = 2 to 9) for metadata in LVM1 format.
For metadata in LVM2 format, the stripe size may be a larger
power of 2 but must not exceed the physical extent size.
.TP
.IR \fB \- T ", " \fB \- \- thin
2011-11-05 02:47:17 +04:00
Creates thin pool or thin logical volume or both.
2014-10-07 16:48:38 +04:00
Specifying the optional argument \fB \- \- size\fP or \fB \- \- extents\fP
will cause the creation of the thin pool logical volume.
2012-04-11 16:42:10 +04:00
Specifying the optional argument \fB \- \- virtualsize\fP will cause
the creation of the thin logical volume from given thin pool volume.
2011-11-05 02:47:17 +04:00
Specifying both arguments will cause the creation of both
thin pool and thin volume using this pool.
2014-06-10 13:05:51 +04:00
See \fB lvmthin\fP (7) for more info about thin provisioning support.
2014-10-07 16:48:38 +04:00
Thin provisioning requires device mapper kernel driver
from kernel 3.2 or greater.
.TP
.IR \fB \- \- thinpool " " ThinPoolLogicalVolume { Name | Path }
Specifies the name of thin pool volume name. The other way to specify pool name
is to append name to Volume group name argument.
2011-11-08 16:12:31 +04:00
.TP
.B \- \- type \fI SegmentType
2014-10-07 16:48:38 +04:00
Creates a logical volume with the specified segment type.
Supported types are:
2014-02-13 19:13:57 +04:00
.IR cache ,
2014-10-07 16:48:38 +04:00
.IR cache-pool ,
2013-04-05 14:24:32 +04:00
.IR error ,
2014-10-07 16:48:38 +04:00
.IR linear ,
.IR mirror,
2013-04-05 14:24:32 +04:00
.IR raid1 ,
.IR raid4 ,
2014-10-07 16:48:38 +04:00
.IR raid5_la ,
.IR raid5_ls " (= " raid5 ),
.IR raid5_ra ,
.IR raid5_rs ,
.IR raid6_nc ,
.IR raid6_nr ,
.IR raid6_zr " (= " raid6 ) ,
.IR raid10 ,
.IR snapshot ,
.IR striped,
.IR thin ,
.IR thin-pool
2013-04-05 14:24:32 +04:00
or
.IR zero .
2014-10-07 16:48:38 +04:00
Segment type may have a commandline switch alias that will
enable its use.
When the type is not explicitly specified an implicit type
is selected from combination of options:
.BR \- H | \- \- cache | \- \- cachepool " (" \fI cache
or
.IR cachepool ),
.BR \- T | \- \- thin | \- \- thinpool " (" \fI thin
or
.IR thinpool ),
.BR \- m | \- \- mirrors " (" \fI raid1
or
.IR mirror ),
.BR \- s | \- \- snapshot | \- V | \- \- virtualsize " (" \fI snapshot
or
.IR thin ),
.BR \- i | \- \- stripes " (" \fI striped ).
Default type is \fI linear\fP .
2011-10-29 00:33:50 +04:00
.TP
2012-04-11 16:42:10 +04:00
.BR \- V ", " \- \- virtualsize " " \fI VirtualSize [ \fI bBsSkKmMgGtTpPeE ]
2014-10-30 21:44:42 +03:00
Creates a thinly provisioned device or a sparse device of the given size (in MiB by default).
See
.BR lvm.conf (5)
settings
.IR global / sparse_segtype_default
to configure default sparse segment type.
2014-10-07 16:48:38 +04:00
See \fB lvmthin\fP (7) for more info about thin provisioning support.
Anything written to a sparse snapshot will be returned when reading from it.
2009-05-27 20:30:29 +04:00
Reading from other areas of the device will return blocks of zeros.
2011-10-29 00:33:50 +04:00
Virtual snapshot is implemented by creating a hidden virtual device of the
2009-04-25 05:17:59 +04:00
requested size using the zero target. A suffix of _vorigin is used for
2013-04-05 14:24:32 +04:00
this device. Note: using sparse snapshots is not efficient for larger
device sizes (GiB), thin provisioning should be used for this case.
2002-01-04 23:35:19 +03:00
.TP
2013-11-27 18:20:12 +04:00
.BR \- W ", " \- \- wipesignatures " {" \fI y | \fI n }
Controls wiping of detected signatures on newly created Logical Volume.
If this option is not specified, then by default signature wiping is done
each time the zeroing (\fB \- Z\fP /\fB \- \- zero\fP ) is done. This default behaviour
2014-10-07 16:48:38 +04:00
can be controlled by
2014-10-30 21:44:42 +03:00
.IR allocation / wipe_signatures_when_zeroing_new_lvs
2014-10-07 16:48:38 +04:00
setting found in
.BR lvm.conf (5).
2013-11-27 18:20:12 +04:00
.br
2014-10-07 16:48:38 +04:00
If blkid wiping is used
2014-10-30 21:44:42 +03:00
.IR allocation / use_blkid_wiping
2014-10-07 16:48:38 +04:00
setting in
.BR lvm.conf (5))
2013-11-27 18:20:12 +04:00
and LVM2 is compiled with blkid wiping support, then \fB blkid\fP (8) library is used
to detect the signatures (use \fB blkid -k\fP command to list the signatures that are recognized).
Otherwise, native LVM2 code is used to detect signatures (MD RAID, swap and LUKS
signatures are detected only in this case).
.br
2014-10-07 16:48:38 +04:00
Logical volume is not wiped if the read only flag is set.
2013-11-27 18:20:12 +04:00
.TP
2011-10-19 20:49:13 +04:00
.BR \- Z ", " \- \- zero " {" \fI y | \fI n }
2013-12-12 13:01:37 +04:00
Controls zeroing of the first 4KiB of data in the new logical volume.
2013-04-05 14:24:32 +04:00
Default is \fI y\fP es.
2014-10-07 16:48:38 +04:00
Snapshot COW volumes are always zeroed.
Logical volume is not zeroed if the read only flag is set.
2002-01-04 23:35:19 +03:00
.br
Warning: trying to mount an unzeroed logical volume can cause the system to
hang.
.SH Examples
2013-04-05 14:24:32 +04:00
Creates a striped logical volume with 3 stripes, a stripe size of 8KiB
and a size of 100MiB in the volume group named vg00.
2011-10-29 00:36:05 +04:00
The logical volume name will be chosen by lvcreate:
.sp
2012-04-11 16:42:10 +04:00
.B lvcreate \- i 3 \- I 8 \- L 100 M vg00
2002-01-04 23:35:19 +03:00
2011-10-29 00:36:05 +04:00
Creates a mirror logical volume with 2 sides with a useable size of 500 MiB.
2013-04-05 14:24:32 +04:00
This operation would require 3 devices (or option
.BI \- \- alloc \ anywhere
) - two for the mirror devices and one for the disk log:
2011-10-29 00:36:05 +04:00
.sp
2012-04-11 16:42:10 +04:00
.B lvcreate \- m1 \- L 500 M vg00
2006-08-19 01:49:19 +04:00
2011-10-29 00:36:05 +04:00
Creates a mirror logical volume with 2 sides with a useable size of 500 MiB.
2012-04-11 16:42:10 +04:00
This operation would require 2 devices - the log is "in-memory":
2011-10-29 00:36:05 +04:00
.sp
2012-04-11 16:42:10 +04:00
.B lvcreate \- m1 \- \- mirrorlog core \- L 500 M vg00
2007-08-02 01:01:06 +04:00
2014-06-17 15:33:42 +04:00
Creates a snapshot logical volume named "vg00/snap" which has access to the
contents of the original logical volume named "vg00/lvol1"
2002-01-04 23:35:19 +03:00
at snapshot logical volume creation time. If the original logical volume
contains a file system, you can mount the snapshot logical volume on an
arbitrary directory in order to access the contents of the filesystem to run
2012-04-11 16:42:10 +04:00
a backup while the original filesystem continues to get updated:
2011-10-29 00:36:05 +04:00
.sp
2012-04-11 16:42:10 +04:00
.B lvcreate \- \- size 100 m \- \- snapshot \- \- name snap /dev/vg00/lvol1
2002-01-04 23:35:19 +03:00
2014-06-17 15:33:42 +04:00
Creates a snapshot logical volume named "vg00/snap" with size
for overwriting 20% of the original logical volume named "vg00/lvol1".:
.sp
.B lvcreate \- s \- l 20 %ORIGIN \- \- name snap vg00/lvol1
2012-04-11 16:42:10 +04:00
Creates a sparse device named /dev/vg1/sparse of size 1TiB with space for just
under 100MiB of actual data on it:
2011-10-29 00:36:05 +04:00
.sp
2012-04-11 16:42:10 +04:00
.B lvcreate \- \- virtualsize 1 T \- \- size 100 M \- \- snapshot \- \- name sparse vg1
2009-08-10 21:23:04 +04:00
2011-10-29 00:36:05 +04:00
Creates a linear logical volume "vg00/lvol1" using physical extents
2014-06-11 13:06:30 +04:00
/dev/sda:0\- 7 and /dev/sdb:0\- 7 for allocation of extents:
2011-10-29 00:36:05 +04:00
.sp
2014-06-11 13:06:30 +04:00
.B lvcreate \- L 64 M \- n lvol1 vg00 /dev/sda:0\-7 /dev/sdb:0\-7
2009-08-10 21:23:04 +04:00
2011-10-29 00:36:05 +04:00
Creates a 5GiB RAID5 logical volume "vg00/my_lv", with 3 stripes (plus
2012-04-11 16:42:10 +04:00
a parity drive for a total of 4 devices) and a stripesize of 64KiB:
2011-10-29 00:36:05 +04:00
.sp
2012-04-11 16:42:10 +04:00
.B lvcreate \- \- type raid5 \- L 5 G \- i 3 \- I 64 \- n my_lv vg00
2009-04-25 05:17:59 +04:00
RAID: Allow implicit stripe (and parity) when creating RAID LVs
There are typically 2 functions for the more advanced segment types that
deal with parameters in lvcreate.c: _get_*_params() and _check_*_params().
(Not all segment types name their functions according to this scheme.)
The former function is responsible for reading parameters before the VG
has been read. The latter is for sanity checking and possibly setting
parameters after the VG has been read.
This patch adds a _check_raid_parameters() function that will determine
if the user has specified 'stripe' or 'mirror' parameters. If not, the
proper number is computed from the list of PVs the user has supplied or
the number that are available in the VG. Now that _check_raid_parameters()
is available, we move the check for proper number of stripes from
_get_* to _check_*.
This gives the user the ability to create RAID LVs as follows:
# 5-device RAID5, 4-data, 1-parity (i.e. implicit '-i 4')
~> lvcreate --type raid5 -L 100G -n lv vg /dev/sd[abcde]1
# 5-device RAID6, 3-data, 2-parity (i.e. implicit '-i 3')
~> lvcreate --type raid6 -L 100G -n lv vg /dev/sd[abcde]1
# If 5 PVs in VG, 4-data, 1-parity RAID5
~> lvcreate --type raid5 -L 100G -n lv vg
Considerations:
This patch only affects RAID. It might also be useful to apply this to
the 'stripe' segment type. LVM RAID may include RAID0 at some point in
the future and the implicit stripes would apply there. It would be odd
to have RAID0 be able to auto-determine the stripe count while 'stripe'
could not.
The only draw-back of this patch that I can see is that there might be
less error checking. Rather than informing the user that they forgot
to supply an argument (e.g. '-i'), the value would be computed and it
may differ from what the user actually wanted. I don't see this as a
problem, because the user can check the device count after creation
and remove the LV if they have made an error.
2014-02-18 06:18:23 +04:00
Creates a RAID5 logical volume "vg00/my_lv", using all of the free
space in the VG and spanning all the PVs in the VG:
.sp
.B lvcreate \- \- type raid5 \- l 100 %FREE \- n my_lv vg00
2012-10-16 00:41:14 +04:00
Creates a 5GiB RAID10 logical volume "vg00/my_lv", with 2 stripes on
RAID: Allow implicit stripe (and parity) when creating RAID LVs
There are typically 2 functions for the more advanced segment types that
deal with parameters in lvcreate.c: _get_*_params() and _check_*_params().
(Not all segment types name their functions according to this scheme.)
The former function is responsible for reading parameters before the VG
has been read. The latter is for sanity checking and possibly setting
parameters after the VG has been read.
This patch adds a _check_raid_parameters() function that will determine
if the user has specified 'stripe' or 'mirror' parameters. If not, the
proper number is computed from the list of PVs the user has supplied or
the number that are available in the VG. Now that _check_raid_parameters()
is available, we move the check for proper number of stripes from
_get_* to _check_*.
This gives the user the ability to create RAID LVs as follows:
# 5-device RAID5, 4-data, 1-parity (i.e. implicit '-i 4')
~> lvcreate --type raid5 -L 100G -n lv vg /dev/sd[abcde]1
# 5-device RAID6, 3-data, 2-parity (i.e. implicit '-i 3')
~> lvcreate --type raid6 -L 100G -n lv vg /dev/sd[abcde]1
# If 5 PVs in VG, 4-data, 1-parity RAID5
~> lvcreate --type raid5 -L 100G -n lv vg
Considerations:
This patch only affects RAID. It might also be useful to apply this to
the 'stripe' segment type. LVM RAID may include RAID0 at some point in
the future and the implicit stripes would apply there. It would be odd
to have RAID0 be able to auto-determine the stripe count while 'stripe'
could not.
The only draw-back of this patch that I can see is that there might be
less error checking. Rather than informing the user that they forgot
to supply an argument (e.g. '-i'), the value would be computed and it
may differ from what the user actually wanted. I don't see this as a
problem, because the user can check the device count after creation
and remove the LV if they have made an error.
2014-02-18 06:18:23 +04:00
2 2-way mirrors. Note that the \fB -i\fP and \fB -m\fP arguments behave
differently.
2013-04-05 14:24:32 +04:00
The \fB -i\fP specifies the number of stripes.
The \fB -m\fP specifies the number of
.B additional
copies:
2012-10-16 00:41:14 +04:00
.sp
.B lvcreate \- \- type raid10 \- L 5 G \- i 2 \- m 1 \- n my_lv vg00
2011-11-05 02:47:17 +04:00
Creates 100MiB pool logical volume for thin provisioning
2012-10-30 21:11:59 +04:00
build with 2 stripes 64KiB and chunk size 256KiB together with
2012-04-11 16:42:10 +04:00
1TiB thin provisioned logical volume "vg00/thin_lv":
2011-11-05 02:47:17 +04:00
.sp
2012-04-11 16:42:10 +04:00
.B lvcreate \- i 2 \- I 64 \- c 256 \- L100M \- T vg00/pool \- V 1 T \- \- name thin_lv
2011-11-05 02:47:17 +04:00
2013-07-15 13:52:05 +04:00
Creates a thin snapshot volume "thinsnap" of thin volume "thinvol" that
will share the same blocks within the thin pool.
Note: the size MUST NOT be specified, otherwise the non-thin snapshot
is created instead:
2013-04-05 14:56:19 +04:00
.sp
2014-06-11 13:06:30 +04:00
.B lvcreate \- s vg00/thinvol \- \- name thinsnap
2013-07-15 13:52:05 +04:00
Creates a thin snapshot volume of read-only inactive volume "origin"
which then becomes the thin external origin for the thin snapshot volume
in vg00 that will use an existing thin pool "vg00/pool":
.sp
2014-06-11 13:06:30 +04:00
.B lvcreate \- s \- \- thinpool vg00/pool origin
2013-04-05 14:56:19 +04:00
2014-02-25 22:17:03 +04:00
Create a cache pool LV that can later be used to cache one
2014-02-12 20:29:07 +04:00
logical volume.
.sp
2014-06-11 13:06:30 +04:00
.B lvcreate \- \- type cache-pool \- L 1 G \- n my_lv_cachepool vg /dev/fast1
2014-02-12 20:29:07 +04:00
2014-02-25 22:17:03 +04:00
If there is an existing cache pool LV, create the large slow
device (i.e. the origin LV) and link it to the supplied cache pool LV,
creating a cache LV.
2014-02-12 20:29:07 +04:00
.sp
2014-10-07 16:48:38 +04:00
.B lvcreate \- \- cache \- L 100 G \- n my_lv vg/my_lv_cachepool /dev/slow1
2014-02-12 20:29:07 +04:00
2014-02-25 22:17:03 +04:00
If there is an existing logical volume, create the small and fast
cache pool LV and link it to the supplied existing logical
volume (i.e. the origin LV), creating a cache LV.
2014-02-12 20:29:07 +04:00
.sp
2014-06-11 13:06:30 +04:00
.B lvcreate \- \- type cache \- L 1 G \- n my_lv_cachepool vg/my_lv /dev/fast1
2014-02-12 20:29:07 +04:00
2014-10-07 16:48:38 +04:00
Create a 1G cached LV "lvol1" with 10M cache pool "vg00/pool".
.sp
.B lvcreate \- \- cache \- L 1 G \- n lv --pooldatasize 10 M vg00/pool
2002-01-04 23:35:19 +03:00
.SH SEE ALSO
2012-04-11 16:42:10 +04:00
.BR lvm (8),
2013-04-05 14:24:32 +04:00
.BR lvm.conf (5),
2014-06-10 13:05:51 +04:00
.BR lvmcache (7),
.BR lvmthin (7),
2013-04-05 14:56:19 +04:00
.BR lvconvert (8),
2012-04-11 16:42:10 +04:00
.BR lvchange (8),
.BR lvextend (8),
.BR lvreduce (8),
2013-04-05 14:24:32 +04:00
.BR lvremove (8),
.BR lvrename (8)
.BR lvs (8),
.BR lvscan (8),
2014-10-07 16:48:38 +04:00
.BR vgcreate (8),
.BR blkid (8)