1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 18:55:19 +03:00
lvm2/man/lvcreate.8
Milan Broz e0096cabef Print warning instead of error message if cannot zero volume
Update lvconvert man page (snapshot option)
2007-01-10 14:13:46 +00:00

178 lines
6.4 KiB
Groff

.TH LVCREATE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvcreate \- create a logical volume in an existing volume group
.SH SYNOPSIS
.B lvcreate
[\-\-addtag Tag]
[\-\-alloc AllocationPolicy]
[\-A/\-\-autobackup y/n] [\-C/\-\-contiguous y/n] [\-d/\-\-debug]
[\-h/\-?/\-\-help]
[\-i/\-\-stripes Stripes [\-I/\-\-stripesize StripeSize]]
{\-l/\-\-extents LogicalExtentsNumber[%{VG|FREE}] |
\-L/\-\-size LogicalVolumeSize[kKmMgGtT]}
[\-M/\-\-persistent y/n] [\-\-minor minor]
[\-m/\-\-mirrors Mirrors [\-\-nosync] [\-\-corelog]
[\-R/\-\-regionsize MirrorLogRegionSize]]
[\-n/\-\-name LogicalVolumeName]
[\-p/\-\-permission r/rw] [\-r/\-\-readahead ReadAheadSectors]
[\-t/\-\-test]
[\-v/\-\-verbose] [\-Z/\-\-zero y/n]
VolumeGroupName [PhysicalVolumePath...]
.br
.br
.B lvcreate
{\-l/\-\-extents LogicalExtentsNumber[%{VG|FREE}] |
\-L/\-\-size LogicalVolumeSize[kKmMgGtT]}
[\-c/\-\-chunksize ChunkSize]
\-s/\-\-snapshot \-n/\-\-name SnapshotLogicalVolumeName OriginalLogicalVolumePath
.SH DESCRIPTION
lvcreate creates a new logical volume in a volume group ( see
.B vgcreate(8), vgchange(8)
) by allocating logical extents from the free physical extent pool
of that volume group. If there are not enough free physical extents then
the volume group can be extended ( see
.B vgextend(8)
) with other physical volumes or by reducing existing logical volumes
of this volume group in size ( see
.B lvreduce(8)
).
.br
The second form supports the creation of snapshot logical volumes which
keep the contents of the original logical volume for backup purposes.
.SH OPTIONS
See \fBlvm\fP for common options.
.TP
.I \-c, \-\-chunksize ChunkSize
Power of 2 chunk size for the snapshot logical volume between 4k and 512k.
.TP
.I \-C, \-\-contiguous y/n
Sets or resets the contiguous allocation policy for
logical volumes. Default is no contiguous allocation based
on a next free principle.
.TP
.I \-i, \-\-stripes Stripes
Gives the number of stripes.
This is equal to the number of physical volumes to scatter
the logical volume.
.TP
.I \-I, \-\-stripesize 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
.I \-l, \-\-extents LogicalExtentsNumber[%{VG|FREE}]
Gives the number of logical extents to allocate for the new
logical volume.
This can also be expressed as a percentage of the total space
in the Volume Group with the suffix %VG or of the remaining free space
with the suffix %FREE.
.TP
.I \-L, \-\-size LogicalVolumeSize[kKmMgGtTpPeE]
Gives the size to allocate for the new logical volume.
A size suffix of K for kilobytes, M for megabytes,
G for gigabytes, T for terabytes, P for petabytes
or E for exabytes is optional.
.br
Default unit is megabytes.
.TP
.I \-\-minor minor
Set the minor number.
.TP
.I \-M, \-\-persistent y/n
Set to y to make the minor number specified persistent.
.TP
.I \-m, \-\-mirrors Mirrors
Creates a mirrored logical volume with "Mirrors" copies. For example,
specifying "-m 1" would result in a mirror with two-sides; that is, a
linear volume plus one copy.
Specifying the optional argument "--nosync" will cause the creation
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
intensive initial sync.
Specifying the optional argument "--corelog" will create a mirror with
an in-memory log verses a disk-based (persistent) log. While this
removes the need for an extra log device and *may* be slightly faster,
it requires that the entire mirror be resynchronized upon each
instantiation (e.g. a reboot).
.TP
.I \-n, \-\-name LogicalVolumeName
The name for the new logical volume.
.br
Without this option a default names of "lvol#" will be generated where
# is the LVM internal number of the logical volume.
.TP
.I \-p, \-\-permission r/w
Set access permissions to read only or read and write.
.br
Default is read and write.
.TP
.I \-r, \-\-readahead ReadAheadSectors
Set read ahead sector count of this logical volume to a value between 2 and 120.
Ignored by device-mapper.
.TP
.I \-R, \-\-regionsize MirrorLogRegionSize
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.
.TP
.I \-s, \-\-snapshot
Create a snapshot logical volume (or snapshot) for an existing, so called
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
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,
15-20% might be enough. In case the snapshot runs out of storage, use
.B lvextend(8)
to grow it. Shrinking a snapshot is supported by
.B lvreduce(8)
as well. Run
.B lvdisplay(8)
on the snapshot in order to check how much data is allocated to it.
.TP
.I \-Z, \-\-zero y/n
Controls zeroing of the first KB of data in the new logical volume.
.br
Default is yes.
.br
Volume will not be zeroed if read only flag is set.
.br
Snapshot volumes are zeroed always.
.br
Warning: trying to mount an unzeroed logical volume can cause the system to
hang.
.SH Examples
"lvcreate -i 3 -I 8 -L 100M vg00" tries to create a striped logical
volume with 3 stripes, a stripesize of 8KB and a size of 100MB in the volume
group named vg00. The logical volume name will be chosen by lvcreate.
"lvcreate -m1 -L 500M vg00" tries to create a mirror logical volume
with 2 sides with a useable size of 500 MiB. This operation would
require 3 devices - two for the mirror devices and one for the disk
log.
"lvcreate --size 100m --snapshot --name snap /dev/vg00/lvol1"
.br
creates a snapshot logical volume named /dev/vg00/snap which has access to the
contents of the original logical volume named /dev/vg00/lvol1
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
a backup while the original filesystem continues to get updated.
.SH SEE ALSO
.BR lvm (8),
.BR vgcreate (8),
.BR lvremove (8),
.BR lvrename (8)
.BR lvextend (8),
.BR lvreduce (8),
.BR lvdisplay (8),
.BR lvscan (8)