]> sourceware.org Git - lvm2.git/blame - man/lvcreate.8.in
Refer to details of snapshot of raid problem.
[lvm2.git] / man / lvcreate.8.in
CommitLineData
5951ef33 1.TH LVCREATE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
922ce479
AK
2.SH NAME
3lvcreate \- create a logical volume in an existing volume group
4.SH SYNOPSIS
5.B lvcreate
789fa12d
ZK
6.RB [ \-\-addtag
7.IR Tag ]
8.RB [ \-\-alloc
9.IR AllocationPolicy ]
10.RB [ \-a | \-\-available
c63b155d 11.RI [ e | l ]{ y | n }]
789fa12d
ZK
12.RB [ \-A | \-\-autobackup
13.RI { y | n }]
14.RB [ \-C | \-\-contiguous
15.RI { y | n }]
16.RB [ \-d | \-\-debug ]
17.RB [ \-h | \-? | \-\-help ]
18.RB [ \-\-noudevsync ]
19.RB [ \-\-ignoremonitoring ]
20.RB [ \-\-monitor
21.RI { y | n }]
22.RB [ \-i | \-\-stripes
23.IR Stripes
24.RB [ \-I | \-\-stripesize
25.IR StripeSize ]]
3d9513ce 26.RB {[ \-l | \-\-extents
789fa12d
ZK
27.IR LogicalExtentsNumber [ % { VG | PVS | FREE }]
28|
29.BR \-L | \-\-size
3d9513ce
ZK
30.IR LogicalVolumeSize [ bBsSkKmMgGtTpPeE ]]
31|
32.BR \-V | \-\-virtualsize
33.IR VirtualSize [ bBsSkKmMgGtTpPeE ]}
789fa12d
ZK
34.RB [ \-M | \-\-persistent
35.RI { y | n }]
36.RB [ \-\-minor
37.IR minor ]
38.RB [ \-m | \-\-mirrors
39.IR Mirrors
40.RB [ \-\-nosync ]
41.RB [ \-\-mirrorlog
42.RI { disk | core | mirrored }
43|
44.BR \-\-corelog ]
45.RB [ \-R | \-\-regionsize
46.IR MirrorLogRegionSize ]]
47.RB [ \-n | \-\-name
485cac0e 48.IR LogicalVolume { Name | Path }]
789fa12d
ZK
49.RB [ \-p | \-\-permission
50.RI { r | rw }]
51.RB [ \-r | \-\-readahead
52.RI { ReadAheadSectors | auto | none }]
53.RB [ \-t | \-\-test ]
3d9513ce 54.RB [ \-T | \-\-thin
3d9513ce
ZK
55.RB [ \-c | \-\-chunksize
56.IR ChunkSize ]
57.RB [ \-\-poolmetadatasize
58.IR MetadataSize [ bBsSkKmMgG ]]]
59.RB [ \-\-thinpool
60.IR ThinPoolLogicalVolume { Name | Path }]
789fa12d
ZK
61.RB [ \-\-type
62.IR SegmentType ]
63.RB [ \-v | \-\-verbose ]
64.RB [ \-Z | \-\-zero
65.RI { y | n }]
3d9513ce 66.IR VolumeGroup { Name | Path }[/ ThinPoolLogicalVolumeName ]
789fa12d 67.RI [ PhysicalVolumePath [ :PE [ -PE ]]...]
922ce479
AK
68.br
69
922ce479 70.B lvcreate
3d9513ce 71.RB [ \-l | \-\-extents
789fa12d
ZK
72.IR LogicalExtentsNumber [ % { VG | FREE | ORIGIN }]
73|
74.BR \-L | \-\-size
3d9513ce 75.IR LogicalVolumeSize [ bBsSkKmMgGtTpPeE ]]
789fa12d
ZK
76.RB [ \-c | \-\-chunksize
77.IR ChunkSize ]
78.RB [ \-\-noudevsync ]
79.RB [ \-\-ignoremonitoring ]
80.RB [ \-\-monitor " {" \fIy | \fIn }]
81.RB [ \-n | \-\-name
485cac0e 82.IR SnapshotLogicalVolume { Name | Path }]
789fa12d 83.BR \-s | \-\-snapshot
43254b11 84.RI {[ VolumeGroup { Name | Path }/] OriginalLogicalVolumeName
789fa12d 85.BR \-V | \-\-virtualsize
485cac0e 86.IR VirtualSize [ bBsSkKmMgGtTpPeE ]}
789fa12d
ZK
87.br
88
922ce479 89.SH DESCRIPTION
c63b155d
ZK
90lvcreate creates a new logical volume in a volume group (see
91.BR vgcreate "(8), " vgchange (8))
92by allocating logical extents from the free physical extent pool
922ce479 93of that volume group. If there are not enough free physical extents then
c63b155d
ZK
94the volume group can be extended (see
95.BR vgextend (8))
96with other physical volumes or by reducing existing logical volumes
97of this volume group in size (see
98.BR lvreduce (8)).
99If you specify one or more PhysicalVolumes, allocation of physical
23087fc9
DW
100extents will be restricted to these volumes.
101.br
922ce479 102.br
c63b155d 103The second form supports the creation of snapshot logical volumes which
922ce479
AK
104keep the contents of the original logical volume for backup purposes.
105.SH OPTIONS
789fa12d
ZK
106See
107.BR lvm (8)
108for common options.
922ce479 109.TP
789fa12d 110.IR \fB\-a ", " \fB\-\-available " {" y | n | ey | en | ly | ln }
c63b155d 111Controls the availability of the Logical Volumes for immediate use after
453cdee5 112the command finishes running.
789fa12d 113By default, new Logical Volumes are activated automatically (\fB-a\fIy\fR).
c63b155d
ZK
114If it is possible technically, \fB-a\fIn\fR will leave the new Logical
115Volume inactive. But for example, snapshots can only be created
116in the active state so \fB\-a\fIn\fR cannot be used with \fB\-\-snapshot\fP.
117Normally the \fB\-\-zero n\fP argument has to be supplied too because
118zeroing (the default behaviour) also requires activation.
119If clustered locking is enabled, \fB\-a\fIey\fR will activate exclusively
120on one node and \fB\-a\fIly\fR will activate only on the local node.
453cdee5 121.TP
789fa12d 122.BR \-c ", " \-\-chunksize " " \fIChunkSize
34a45b00
ZK
123Gives the size of chunk for snapshot and thin pool logical volumes.
124For snapshots the value must be power of 2 between 4KiB and 512KiB
125and the default value is 4.
126For thin pools the value must be power of 2 between 64KiB and
1271048576KiB and the default value starts with 64 and scales
c63b155d 128up to fit the pool metadata size within 128MB,
34a45b00
ZK
129if the poolmetadata size is not specified.
130Default unit is in kilobytes.
922ce479 131.TP
789fa12d 132.BR \-C ", " \-\-contiguous " {" \fIy | \fIn }
922ce479
AK
133Sets or resets the contiguous allocation policy for
134logical volumes. Default is no contiguous allocation based
135on a next free principle.
136.TP
789fa12d 137.BR \-i ", " \-\-stripes " " \fIStripes
922ce479
AK
138Gives the number of stripes.
139This is equal to the number of physical volumes to scatter
140the logical volume.
141.TP
789fa12d 142.BR \-I ", " \-\-stripesize " " \fIStripeSize
922ce479
AK
143Gives the number of kilobytes for the granularity of the stripes.
144.br
12de747d
AK
145StripeSize must be 2^n (n = 2 to 9) for metadata in LVM1 format.
146For metadata in LVM2 format, the stripe size may be a larger
147power of 2 but must not exceed the physical extent size.
922ce479 148.TP
789fa12d 149.IR \fB\-l ", " \fB\-\-extents " " LogicalExtentsNumber [ % { VG | PVS | FREE | ORIGIN }]
922ce479
AK
150Gives the number of logical extents to allocate for the new
151logical volume.
5bc2af26 152The number can also be expressed as a percentage of the total space
789fa12d
ZK
153in the Volume Group with the suffix \fI%VG\fR, as a percentage of the
154remaining free space in the Volume Group with the suffix \fI%FREE\fR, as a
5bc2af26 155percentage of the remaining free space for the specified
789fa12d 156PhysicalVolume(s) with the suffix \fI%PVS\fR, or (for a snapshot) as a
5bc2af26 157percentage of the total space in the Origin Logical Volume with the
789fa12d 158suffix \fI%ORIGIN\fR.
922ce479 159.TP
789fa12d 160.IR \fB\-L ", " \fB\-\-size " " LogicalVolumeSize [ bBsSkKmMgGtTpPeE ]
922ce479 161Gives the size to allocate for the new logical volume.
789fa12d
ZK
162A size suffix of \fIK\fR for kilobytes, \fIM\fR for megabytes,
163\fIG\fR for gigabytes, \fIT\fR for terabytes, \fIP\fR for petabytes
164or \fIE\fR for exabytes is optional.
922ce479
AK
165.br
166Default unit is megabytes.
167.TP
789fa12d 168.B \-\-minor \fIminor
5a52dca9
AK
169Set the minor number.
170.TP
789fa12d 171.IR \fB\-M ", " \fB\-\-persistent " {" y | n }
5a52dca9
AK
172Set to y to make the minor number specified persistent.
173.TP
789fa12d 174.BR \-m ", " \-\-mirrors " " \fIMirrors
230948b9 175Creates a mirrored logical volume with Mirrors copies. For example,
48432c88
AK
176specifying "-m 1" would result in a mirror with two-sides; that is, a
177linear volume plus one copy.
178
230948b9 179Specifying the optional argument --nosync will cause the creation
48432c88
AK
180of the mirror to skip the initial resynchronization. Any data written
181afterwards will be mirrored, but the original contents will not be
182copied. This is useful for skipping a potentially long and resource
230948b9 183intensive initial sync of an empty device.
48432c88 184
230948b9
AK
185The optional argument --mirrorlog specifies the type of log to be used.
186The default is disk, which is persistent and requires
187a small amount of storage space, usually on a separate device from the
7a369d37 188data being mirrored. Using core means the mirror is regenerated
230948b9 189by copying the data from the first device again each time the
7a369d37
JEB
190device is activated, for example, after every reboot. Using "mirrored"
191will create a persistent log that is itself mirrored.
a6d4f21c 192
2b849ab4 193The optional argument --corelog is equivalent to --mirrorlog core.
a6d4f21c 194
48432c88 195.TP
485cac0e 196.IR \fB\-n ", " \fB\-\-name " " LogicalVolume { Name | Path }
922ce479
AK
197The name for the new logical volume.
198.br
199Without this option a default names of "lvol#" will be generated where
200# is the LVM internal number of the logical volume.
201.TP
789fa12d 202.B \-\-noudevsync
c48b1005
PR
203Disable udev synchronisation. The
204process will not wait for notification from udev.
205It will continue irrespective of any possible udev processing
206in the background. You should only use this if udev is not running
207or has rules that ignore the devices LVM2 creates.
208.TP
789fa12d 209.BR \-\-monitor " {" \fIy | \fIn }
a6bc975a 210Start or avoid monitoring a mirrored or snapshot logical volume with
c63b155d 211dmeventd, if it is installed.
a6bc975a 212If a device used by a monitored mirror reports an I/O error,
c63b155d 213the failure is handled according to
a6bc975a
MS
214\fBmirror_image_fault_policy\fP and \fBmirror_log_fault_policy\fP
215set in \fBlvm.conf\fP.
216.TP
789fa12d 217.B \-\-ignoremonitoring
a6bc975a
MS
218Make no attempt to interact with dmeventd unless \-\-monitor
219is specified.
220.TP
789fa12d 221.BR \-p ", " \-\-permission " {" \fIr | \fIrw }
922ce479
AK
222Set access permissions to read only or read and write.
223.br
224Default is read and write.
7060c9d9
ZK
225.TP
226.IR \fB\-\-poolmetadatasize " " MetadataSize [ bBsSkKmMgG ]
227Set the size of thin pool's metadata logical volume.
228Supported value is in range between 2MiB and 16GiB.
229Default value is (Pool_LV_size / Pool_LV_chunk_size * 64b).
08525624 230Default unit is megabytes.
922ce479 231.TP
789fa12d 232.IR \fB\-r ", " \fB\-\-readahead " {" ReadAheadSectors | auto | none }
b4068515
AK
233Set read ahead sector count of this logical volume.
234For volume groups with metadata in lvm1 format, this must
235be a value between 2 and 120.
236The default value is "auto" which allows the kernel to choose
237a suitable value automatically.
238"None" is equivalent to specifying zero.
922ce479 239.TP
789fa12d 240.BR \-R ", " \-\-regionsize " " \fIMirrorLogRegionSize
c63b155d 241A mirror is divided into regions of this size (in MB), and the mirror log
12ccdb25
AK
242uses this granularity to track which regions are in sync.
243.TP
43254b11 244.IR \fB\-s ", " \fB\-\-snapshot " " OriginalLogicalVolume { Name | Path }
922ce479
AK
245Create a snapshot logical volume (or snapshot) for an existing, so called
246original logical volume (or origin).
247Snapshots provide a 'frozen image' of the contents of the origin
248while the origin can still be updated. They enable consistent
43254b11
ZK
249backups and online recovery of removed/overwritten data/files.
250Thin snapshot is created when the origin is a thin volume and
251the size is not specified. Thin snapshot shares same blocks within
252the thin pool volume.
253The snapshot with the specified size does not need the same amount of
254storage the origin has. In a typical scenario, 15-20% might be enough.
255In case the snapshot runs out of storage, use
789fa12d 256.BR lvextend (8)
922ce479 257to grow it. Shrinking a snapshot is supported by
789fa12d 258.BR lvreduce (8)
922ce479 259as well. Run
789fa12d 260.BR lvdisplay (8)
922ce479 261on the snapshot in order to check how much data is allocated to it.
87f42fda 262Note that a small amount of the space you allocate to the snapshot is
c5185d4c 263used to track the locations of the chunks of data, so you should
87f42fda
AK
264allocate slightly more space than you actually need and monitor the
265rate at which the snapshot data is growing so you can avoid running out
266of space.
267.TP
485cac0e 268.IR \fB\-T ", " \fB\-\-thin ", " \fB\-\-thinpool " " ThinPoolLogicalVolume { Name | Path }
7060c9d9 269Creates thin pool or thin logical volume or both.
c63b155d 270Specifying the optional argument \fB\-\-size\fP will cause the creation of
7060c9d9 271the thin pool logical volume.
c63b155d
ZK
272Specifying the optional argument \fB\-\-virtualsize\fP will cause
273the creation of the thin logical volume from given thin pool volume.
7060c9d9
ZK
274Specifying both arguments will cause the creation of both
275thin pool and thin volume using this pool.
276Requires device mapper kernel driver for thin provisioning
277from kernel 3.2 or newer.
485cac0e
ZK
278.TP
279.B \-\-type \fISegmentType
280Create a logical volume that uses the specified segment type
301e821d 281(e.g. "raid5", "mirror", "snapshot", "thin", "thin-pool").
485cac0e 282Many segment types have a
c63b155d
ZK
283commandline switch alias that will enable their use
284(\fB\-s\fP is an alias for \fB\-\-type snapshot\fP).
285However, this argument must be used when no existing
286commandline switch alias is available for the desired type,
287as is the case with
288.IR error ", " zero ", " raid1 ", " raid4 ", " raid5 " or " raid6 .
620ff9e9 289.TP
c63b155d 290.BR \-V ", " \-\-virtualsize " " \fIVirtualSize [ \fIbBsSkKmMgGtTpPeE ]
620ff9e9
ZK
291Create a sparse device of the given size (in MB by default) using a snapshot
292or thinly provisioned device when thin pool is specified.
154753db
AK
293Anything written to the device will be returned when reading from it.
294Reading from other areas of the device will return blocks of zeros.
620ff9e9 295Virtual snapshot is implemented by creating a hidden virtual device of the
87f42fda
AK
296requested size using the zero target. A suffix of _vorigin is used for
297this device.
922ce479 298.TP
789fa12d 299.BR \-Z ", " \-\-zero " {" \fIy | \fIn }
922ce479
AK
300Controls zeroing of the first KB of data in the new logical volume.
301.br
302Default is yes.
e0096cab
MB
303.br
304Volume will not be zeroed if read only flag is set.
305.br
306Snapshot volumes are zeroed always.
922ce479
AK
307
308.br
309Warning: trying to mount an unzeroed logical volume can cause the system to
310hang.
311.SH Examples
c63b155d 312Creates a striped logical volume with 3 stripes, a stripesize of 8KB
070f7171
ZK
313and a size of 100MB in the volume group named vg00.
314The logical volume name will be chosen by lvcreate:
315.sp
c63b155d 316.B lvcreate \-i 3 \-I 8 \-L 100M vg00
922ce479 317
070f7171 318Creates a mirror logical volume with 2 sides with a useable size of 500 MiB.
c63b155d
ZK
319This operation would require 3 devices (or option --alloc anywhere) - two
320for the mirror devices and one for the disk log:
070f7171 321.sp
c63b155d 322.B lvcreate \-m1 \-L 500M vg00
48432c88 323
070f7171 324Creates a mirror logical volume with 2 sides with a useable size of 500 MiB.
c63b155d 325This operation would require 2 devices - the log is "in-memory":
070f7171 326.sp
c63b155d 327.B lvcreate \-m1 \-\-mirrorlog core \-L 500M vg00
19583d11 328
070f7171 329Creates a snapshot logical volume named /dev/vg00/snap which has access to the
922ce479
AK
330contents of the original logical volume named /dev/vg00/lvol1
331at snapshot logical volume creation time. If the original logical volume
332contains a file system, you can mount the snapshot logical volume on an
333arbitrary directory in order to access the contents of the filesystem to run
c63b155d 334a backup while the original filesystem continues to get updated:
070f7171 335.sp
c63b155d 336.B lvcreate \-\-size 100m \-\-snapshot \-\-name snap /dev/vg00/lvol1
922ce479 337
c63b155d
ZK
338Creates a sparse device named /dev/vg1/sparse of size 1TiB with space for just
339under 100MiB of actual data on it:
070f7171 340.sp
c63b155d 341.B lvcreate \-\-virtualsize 1T \-\-size 100M \-\-snapshot \-\-name sparse vg1
c808baef 342
070f7171 343Creates a linear logical volume "vg00/lvol1" using physical extents
c63b155d 344/dev/sda:0-7 and /dev/sdb:0-7 for allocation of extents:
070f7171 345.sp
c63b155d 346.B lvcreate \-L 64M -n lvol1 vg00 /dev/sda:0\-7 /dev/sdb:0\-7
c808baef 347
070f7171 348Creates a 5GiB RAID5 logical volume "vg00/my_lv", with 3 stripes (plus
c63b155d 349a parity drive for a total of 4 devices) and a stripesize of 64KiB:
070f7171 350.sp
c63b155d 351.B lvcreate \-\-type raid5 \-L 5G \-i 3 \-I 64 \-n my_lv vg00
87f42fda 352
7060c9d9
ZK
353Creates 100MiB pool logical volume for thin provisioning
354build with 2 stripes 64KiB and chunk size 128KiB together with
c63b155d 3551TiB thin provisioned logical volume "vg00/thin_lv":
7060c9d9 356.sp
c63b155d 357.B lvcreate \-i 2 \-I 64 \-c 256 \-L100M \-T vg00/pool \-V 1T \-\-name thin_lv
7060c9d9 358
922ce479 359.SH SEE ALSO
c63b155d
ZK
360.BR lvm (8),
361.BR vgcreate (8),
362.BR lvchange (8),
363.BR lvremove (8),
922ce479 364.BR lvrename (8)
c63b155d
ZK
365.BR lvextend (8),
366.BR lvreduce (8),
367.BR lvdisplay (8),
922ce479 368.BR lvscan (8)
This page took 0.292551 seconds and 5 git commands to generate.