1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-11 20:58:50 +03:00

Improve lvcreate man page

Split syntax for thin-pool since it cannot be fully matched with snapshot.
So to avoid more confusion - take thin support into separate line.

Though still significant updates are needed for thin provisioning.
This commit is contained in:
Zdenek Kabelac 2011-10-19 16:49:13 +00:00
parent d495dd40b2
commit 789fa12d62
2 changed files with 131 additions and 72 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.89 - Version 2.02.89 -
================================== ==================================
Improve man page style for lvcreate.
Avoid recursive calls to dmeventd in its LVM plugins. Avoid recursive calls to dmeventd in its LVM plugins.
Log dev name now returned to kernel for registering during cmirror CTR. Log dev name now returned to kernel for registering during cmirror CTR.
Fix lv_info open_count test for disabled verify_udev_operations (2.02.86). Fix lv_info open_count test for disabled verify_udev_operations (2.02.86).

View File

@ -3,52 +3,108 @@
lvcreate \- create a logical volume in an existing volume group lvcreate \- create a logical volume in an existing volume group
.SH SYNOPSIS .SH SYNOPSIS
.B lvcreate .B lvcreate
[\-\-addtag Tag] .RB [ \-\-addtag
[\-\-alloc AllocationPolicy] .IR Tag ]
[\-a|\-\-available y|n|ey|en|ly|ln] .RB [ \-\-alloc
[\-A|\-\-autobackup y|n] [\-C|\-\-contiguous y|n] [\-d|\-\-debug] .IR AllocationPolicy ]
[\-h|\-?|\-\-help] [\-\-noudevsync] .RB [ \-a | \-\-available
[\-\-ignoremonitoring] .RI { y | n | ey | en | ly | ln }]
[\-\-monitor {y|n}] .RB [ \-A | \-\-autobackup
[\-i|\-\-stripes Stripes [\-I|\-\-stripesize StripeSize]] .RI { y | n }]
{\-l|\-\-extents LogicalExtentsNumber[%{VG|PVS|FREE}] | .RB [ \-C | \-\-contiguous
\-L|\-\-size LogicalVolumeSize[bBsSkKmMgGtTpPeE]} .RI { y | n }]
[\-M|\-\-persistent y|n] [\-\-minor minor] .RB [ \-d | \-\-debug ]
[\-m|\-\-mirrors Mirrors [\-\-nosync] [\-\-mirrorlog {disk|core|mirrored}] [\-\-corelog] .RB [ \-h | \-? | \-\-help ]
[\-R|\-\-regionsize MirrorLogRegionSize]] .RB [ \-\-noudevsync ]
[\-n|\-\-name LogicalVolumeName] .RB [ \-\-ignoremonitoring ]
[\-p|\-\-permission r|rw] [\-r|\-\-readahead ReadAheadSectors|auto|none] .RB [ \-\-monitor
[\-t|\-\-test] .RI { y | n }]
[\-\-type SegmentType] .RB [ \-i | \-\-stripes
[\-v|\-\-verbose] [\-Z|\-\-zero y|n] .IR Stripes
VolumeGroupName [PhysicalVolumePath[:PE[-PE]]...] .RB [ \-I | \-\-stripesize
.IR StripeSize ]]
.RB { \-l | \-\-extents
.IR LogicalExtentsNumber [ % { VG | PVS | FREE }]
|
.BR \-L | \-\-size
.IR LogicalVolumeSize [ bBsSkKmMgGtTpPeE ]}
.RB [ \-M | \-\-persistent
.RI { y | n }]
.RB [ \-\-minor
.IR minor ]
.RB [ \-m | \-\-mirrors
.IR Mirrors
.RB [ \-\-nosync ]
.RB [ \-\-mirrorlog
.RI { disk | core | mirrored }
|
.BR \-\-corelog ]
.RB [ \-R | \-\-regionsize
.IR MirrorLogRegionSize ]]
.RB [ \-n | \-\-name
.IR LogicalVolumeName ]
.RB [ \-p | \-\-permission
.RI { r | rw }]
.RB [ \-r | \-\-readahead
.RI { ReadAheadSectors | auto | none }]
.RB [ \-t | \-\-test ]
.RB [ \-\-type
.IR SegmentType ]
.RB [ \-v | \-\-verbose ]
.RB [ \-Z | \-\-zero
.RI { y | n }]
.IR VolumeGroupName
.RI [ PhysicalVolumePath [ :PE [ -PE ]]...]
.br .br
.br .br
.B lvcreate .B lvcreate
{\-l|\-\-extents LogicalExtentsNumber[%{VG|FREE|ORIGIN}] | .RB { \-l | \-\-extents
\-L|\-\-size LogicalVolumeSize[bBsSkKmMgGtTpPeE]} .IR LogicalExtentsNumber [ % { VG | FREE | ORIGIN }]
[\-c|\-\-chunksize ChunkSize] |
[\-\-noudevsync] .BR \-L | \-\-size
[\-\-ignoremonitoring] .IR LogicalVolumeSize [ bBsSkKmMgGtTpPeE ]}
[\-\-monitor {y|n}] .RB [ \-c | \-\-chunksize
[--thinpool ThinPoolLogicalVolumeName] .IR ChunkSize ]
[\-n|\-\-name SnapshotLogicalVolumeName] .RB [ \-\-noudevsync ]
{{\-s|\-\-snapshot} .RB [ \-\-ignoremonitoring ]
OriginalLogicalVolumePath | .RB [ \-\-monitor " {" \fIy | \fIn }]
[\-s|\-\-snapshot] .RB [ \-n | \-\-name
VolumeGroupName \-V|\-\-virtualsize VirtualSize | .IR SnapshotLogicalVolumeName ]
-T VolumeGroupName[/ThinPoolLogicalVolumeName] \-V|\-\-virtualsize VirtualSize} .BR \-s | \-\-snapshot
.RI [ OriginalLogicalVolumePath
|
.IR VolumeGroupName
.BR \-V | \-\-virtualsize
.IR VirtualSize ]
.br
.B lvcreate
.RB [ \-l | \-\-extents
.IR LogicalExtentsNumber [ % { VG | FREE | ORIGIN }]
|
.BR \-L | \-\-size
.IR LogicalVolumeSize [ bBsSkKmMgGtTpPeE ]]
.RB [ \-V | \-\-virtualsize
.IR VirtualSize ]
.RB [ \-n | \-\-name
.IR ThinLogicalVolumeName ]
.RB [ \-\-thinpool
.IR ThinPoolLogicalVolumeName ]
.B \-T
.IR VolumeGroupName [/ ThinPoolLogicalVolumeName ]
.br
.SH DESCRIPTION .SH DESCRIPTION
lvcreate creates a new logical volume in a volume group ( see lvcreate creates a new logical volume in a volume group ( see
.B vgcreate(8), vgchange(8) .BR vgcreate "(8), " vgchange (8)
) by allocating logical extents from the free physical extent pool ) by allocating logical extents from the free physical extent pool
of that volume group. If there are not enough free physical extents then of that volume group. If there are not enough free physical extents then
the volume group can be extended ( see the volume group can be extended ( see
.B vgextend(8) .BR vgextend (8)
) with other physical volumes or by reducing existing logical volumes ) with other physical volumes or by reducing existing logical volumes
of this volume group in size ( see of this volume group in size ( see
.B lvreduce(8) .BR lvreduce (8)
). If you specify one or more PhysicalVolumes, allocation of physical ). If you specify one or more PhysicalVolumes, allocation of physical
extents will be restricted to these volumes. extents will be restricted to these volumes.
.br .br
@ -56,66 +112,68 @@ extents will be restricted to these volumes.
The second form supports the creation of snapshot logical volumes which The second form supports the creation of snapshot logical volumes which
keep the contents of the original logical volume for backup purposes. keep the contents of the original logical volume for backup purposes.
.SH OPTIONS .SH OPTIONS
See \fBlvm\fP for common options. See
.BR lvm (8)
for common options.
.TP .TP
.I \-a, \-\-available y|n|ey|en|ly|ln .IR \fB\-a ", " \fB\-\-available " {" y | n | ey | en | ly | ln }
Controls the availability of the Logical Volumes for immediate use after Controls the availability of the Logical Volumes for immediate use after
the command finishes running. the command finishes running.
By default, new Logical Volumes are activated automatically (-ay). By default, new Logical Volumes are activated automatically (\fB-a\fIy\fR).
If it is possible technically, -an will leave the new Logical Volume inactive. If it is possible technically, \fB-a\fIn\fR will leave the new Logical Volume inactive.
But for example, snapshots can only be created But for example, snapshots can only be created
in the active state so -an cannot be used with --snapshot. in the active state so \fB-a\fIn\fR cannot be used with --snapshot.
Normally the --zero n argument has to be supplied too because zeroing (the Normally the --zero n argument has to be supplied too because zeroing (the
default behaviour) also requires activation. default behaviour) also requires activation.
If clustered locking is enabled, -aey will activate exclusively If clustered locking is enabled, \fB-a\fIey\fR will activate exclusively
on one node and -aly will activate only on the local node. on one node and \fB-a\fIly\fR will activate only on the local node.
.TP .TP
.I \-c, \-\-chunksize ChunkSize .BR \-c ", " \-\-chunksize " " \fIChunkSize
Power of 2 chunk size for the snapshot logical volume between 4k and 512k. Power of 2 chunk size for the snapshot logical volume between 4k and 512k.
.TP .TP
.I \-C, \-\-contiguous y|n .BR \-C ", " \-\-contiguous " {" \fIy | \fIn }
Sets or resets the contiguous allocation policy for Sets or resets the contiguous allocation policy for
logical volumes. Default is no contiguous allocation based logical volumes. Default is no contiguous allocation based
on a next free principle. on a next free principle.
.TP .TP
.I \-i, \-\-stripes Stripes .BR \-i ", " \-\-stripes " " \fIStripes
Gives the number of stripes. Gives the number of stripes.
This is equal to the number of physical volumes to scatter This is equal to the number of physical volumes to scatter
the logical volume. the logical volume.
.TP .TP
.I \-I, \-\-stripesize StripeSize .BR \-I ", " \-\-stripesize " " \fIStripeSize
Gives the number of kilobytes for the granularity of the stripes. Gives the number of kilobytes for the granularity of the stripes.
.br .br
StripeSize must be 2^n (n = 2 to 9) for metadata in LVM1 format. 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 For metadata in LVM2 format, the stripe size may be a larger
power of 2 but must not exceed the physical extent size. power of 2 but must not exceed the physical extent size.
.TP .TP
.I \-l, \-\-extents LogicalExtentsNumber[%{VG|PVS|FREE|ORIGIN}] .IR \fB\-l ", " \fB\-\-extents " " LogicalExtentsNumber [ % { VG | PVS | FREE | ORIGIN }]
Gives the number of logical extents to allocate for the new Gives the number of logical extents to allocate for the new
logical volume. logical volume.
The number can also be expressed as a percentage of the total space The number can also be expressed as a percentage of the total space
in the Volume Group with the suffix %VG, as a percentage of the 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 %FREE, as a remaining free space in the Volume Group with the suffix \fI%FREE\fR, as a
percentage of the remaining free space for the specified percentage of the remaining free space for the specified
PhysicalVolume(s) with the suffix %PVS, or (for a snapshot) as a PhysicalVolume(s) with the suffix \fI%PVS\fR, or (for a snapshot) as a
percentage of the total space in the Origin Logical Volume with the percentage of the total space in the Origin Logical Volume with the
suffix %ORIGIN. suffix \fI%ORIGIN\fR.
.TP .TP
.I \-L, \-\-size LogicalVolumeSize[bBsSkKmMgGtTpPeE] .IR \fB\-L ", " \fB\-\-size " " LogicalVolumeSize [ bBsSkKmMgGtTpPeE ]
Gives the size to allocate for the new logical volume. Gives the size to allocate for the new logical volume.
A size suffix of K for kilobytes, M for megabytes, A size suffix of \fIK\fR for kilobytes, \fIM\fR for megabytes,
G for gigabytes, T for terabytes, P for petabytes \fIG\fR for gigabytes, \fIT\fR for terabytes, \fIP\fR for petabytes
or E for exabytes is optional. or \fIE\fR for exabytes is optional.
.br .br
Default unit is megabytes. Default unit is megabytes.
.TP .TP
.I \-\-minor minor .B \-\-minor \fIminor
Set the minor number. Set the minor number.
.TP .TP
.I \-M, \-\-persistent y|n .IR \fB\-M ", " \fB\-\-persistent " {" y | n }
Set to y to make the minor number specified persistent. Set to y to make the minor number specified persistent.
.TP .TP
.I \-m, \-\-mirrors Mirrors .BR \-m ", " \-\-mirrors " " \fIMirrors
Creates a mirrored logical volume with Mirrors copies. For example, Creates a mirrored logical volume with Mirrors copies. For example,
specifying "-m 1" would result in a mirror with two-sides; that is, a specifying "-m 1" would result in a mirror with two-sides; that is, a
linear volume plus one copy. linear volume plus one copy.
@ -137,20 +195,20 @@ will create a persistent log that is itself mirrored.
The optional argument --corelog is equivalent to --mirrorlog core. The optional argument --corelog is equivalent to --mirrorlog core.
.TP .TP
.I \-n, \-\-name LogicalVolumeName .BR \-n ", " \-\-name " " \fILogicalVolumeName
The name for the new logical volume. The name for the new logical volume.
.br .br
Without this option a default names of "lvol#" will be generated where Without this option a default names of "lvol#" will be generated where
# is the LVM internal number of the logical volume. # is the LVM internal number of the logical volume.
.TP .TP
.I \-\-noudevsync .B \-\-noudevsync
Disable udev synchronisation. The Disable udev synchronisation. The
process will not wait for notification from udev. process will not wait for notification from udev.
It will continue irrespective of any possible udev processing It will continue irrespective of any possible udev processing
in the background. You should only use this if udev is not running in the background. You should only use this if udev is not running
or has rules that ignore the devices LVM2 creates. or has rules that ignore the devices LVM2 creates.
.TP .TP
.I \-\-monitor y|n .BR \-\-monitor " {" \fIy | \fIn }
Start or avoid monitoring a mirrored or snapshot logical volume with Start or avoid monitoring a mirrored or snapshot logical volume with
dmeventd, if it is installed. dmeventd, if it is installed.
If a device used by a monitored mirror reports an I/O error, If a device used by a monitored mirror reports an I/O error,
@ -158,16 +216,16 @@ the failure is handled according to
\fBmirror_image_fault_policy\fP and \fBmirror_log_fault_policy\fP \fBmirror_image_fault_policy\fP and \fBmirror_log_fault_policy\fP
set in \fBlvm.conf\fP. set in \fBlvm.conf\fP.
.TP .TP
.I \-\-ignoremonitoring .B \-\-ignoremonitoring
Make no attempt to interact with dmeventd unless \-\-monitor Make no attempt to interact with dmeventd unless \-\-monitor
is specified. is specified.
.TP .TP
.I \-p, \-\-permission r|rw .BR \-p ", " \-\-permission " {" \fIr | \fIrw }
Set access permissions to read only or read and write. Set access permissions to read only or read and write.
.br .br
Default is read and write. Default is read and write.
.TP .TP
.I \-r, \-\-readahead ReadAheadSectors|auto|none .IR \fB\-r ", " \fB\-\-readahead " {" ReadAheadSectors | auto | none }
Set read ahead sector count of this logical volume. Set read ahead sector count of this logical volume.
For volume groups with metadata in lvm1 format, this must For volume groups with metadata in lvm1 format, this must
be a value between 2 and 120. be a value between 2 and 120.
@ -175,11 +233,11 @@ The default value is "auto" which allows the kernel to choose
a suitable value automatically. a suitable value automatically.
"None" is equivalent to specifying zero. "None" is equivalent to specifying zero.
.TP .TP
.I \-R, \-\-regionsize MirrorLogRegionSize .BR \-R ", " \-\-regionsize " " \fIMirrorLogRegionSize
A mirror is divided into regions of this size (in MB), and the mirror log A mirror is divided into regions of this size (in MB), and the mirror log
uses this granularity to track which regions are in sync. uses this granularity to track which regions are in sync.
.TP .TP
.I \-s, \-\-snapshot .BR \-s ", " \-\-snapshot
Create a snapshot logical volume (or snapshot) for an existing, so called Create a snapshot logical volume (or snapshot) for an existing, so called
original logical volume (or origin). original logical volume (or origin).
Snapshots provide a 'frozen image' of the contents of the origin Snapshots provide a 'frozen image' of the contents of the origin
@ -187,11 +245,11 @@ while the origin can still be updated. They enable consistent
backups and online recovery of removed/overwritten data/files. The snapshot backups and online recovery of removed/overwritten data/files. The snapshot
does not need the same amount of storage the origin has. In a typical scenario, 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 15-20% might be enough. In case the snapshot runs out of storage, use
.B lvextend(8) .BR lvextend (8)
to grow it. Shrinking a snapshot is supported by to grow it. Shrinking a snapshot is supported by
.B lvreduce(8) .BR lvreduce (8)
as well. Run as well. Run
.B lvdisplay(8) .BR lvdisplay (8)
on the snapshot in order to check how much data is allocated to it. on the snapshot in order to check how much data is allocated to it.
Note that a small amount of the space you allocate to the snapshot is Note that a small amount of the space you allocate to the snapshot is
used to track the locations of the chunks of data, so you should used to track the locations of the chunks of data, so you should
@ -199,7 +257,7 @@ allocate slightly more space than you actually need and monitor the
rate at which the snapshot data is growing so you can avoid running out rate at which the snapshot data is growing so you can avoid running out
of space. of space.
.TP .TP
.I \-\-type SegmentType .B \-\-type \fISegmentType
Create a logical volume that uses the specified segment type Create a logical volume that uses the specified segment type
(e.g. "raid5", "mirror", "snapshot"). Many segment types have a (e.g. "raid5", "mirror", "snapshot"). Many segment types have a
commandline switch alias that will enable their use (-s is an alias for commandline switch alias that will enable their use (-s is an alias for
@ -207,7 +265,7 @@ commandline switch alias that will enable their use (-s is an alias for
commandline switch alias is available for the desired type, as is the case commandline switch alias is available for the desired type, as is the case
with "error", "zero", "raid4", "raid5", or "raid6". with "error", "zero", "raid4", "raid5", or "raid6".
.TP .TP
.I -V, \-\-virtualsize VirtualSize .BR \-V ", " \-\-virtualsize " " \fIVirtualSize
Create a sparse device of the given size (in MB by default) using a snapshot. Create a sparse device of the given size (in MB by default) using a snapshot.
Anything written to the device will be returned when reading from it. Anything written to the device will be returned when reading from it.
Reading from other areas of the device will return blocks of zeros. Reading from other areas of the device will return blocks of zeros.
@ -215,7 +273,7 @@ It is implemented by creating a hidden virtual device of the
requested size using the zero target. A suffix of _vorigin is used for requested size using the zero target. A suffix of _vorigin is used for
this device. this device.
.TP .TP
.I \-Z, \-\-zero y|n .BR \-Z ", " \-\-zero " {" \fIy | \fIn }
Controls zeroing of the first KB of data in the new logical volume. Controls zeroing of the first KB of data in the new logical volume.
.br .br
Default is yes. Default is yes.