]>
Commit | Line | Data |
---|---|---|
5951ef33 | 1 | .TH LVCREATE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*- |
922ce479 AK |
2 | .SH NAME |
3 | lvcreate \- 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 |
90 | lvcreate creates a new logical volume in a volume group (see |
91 | .BR vgcreate "(8), " vgchange (8)) | |
92 | by allocating logical extents from the free physical extent pool | |
922ce479 | 93 | of that volume group. If there are not enough free physical extents then |
c63b155d ZK |
94 | the volume group can be extended (see |
95 | .BR vgextend (8)) | |
96 | with other physical volumes or by reducing existing logical volumes | |
97 | of this volume group in size (see | |
98 | .BR lvreduce (8)). | |
99 | If you specify one or more PhysicalVolumes, allocation of physical | |
23087fc9 DW |
100 | extents will be restricted to these volumes. |
101 | .br | |
922ce479 | 102 | .br |
c63b155d | 103 | The second form supports the creation of snapshot logical volumes which |
922ce479 AK |
104 | keep the contents of the original logical volume for backup purposes. |
105 | .SH OPTIONS | |
789fa12d ZK |
106 | See |
107 | .BR lvm (8) | |
108 | for common options. | |
922ce479 | 109 | .TP |
789fa12d | 110 | .IR \fB\-a ", " \fB\-\-available " {" y | n | ey | en | ly | ln } |
c63b155d | 111 | Controls the availability of the Logical Volumes for immediate use after |
453cdee5 | 112 | the command finishes running. |
789fa12d | 113 | By default, new Logical Volumes are activated automatically (\fB-a\fIy\fR). |
c63b155d ZK |
114 | If it is possible technically, \fB-a\fIn\fR will leave the new Logical |
115 | Volume inactive. But for example, snapshots can only be created | |
116 | in the active state so \fB\-a\fIn\fR cannot be used with \fB\-\-snapshot\fP. | |
117 | Normally the \fB\-\-zero n\fP argument has to be supplied too because | |
118 | zeroing (the default behaviour) also requires activation. | |
119 | If clustered locking is enabled, \fB\-a\fIey\fR will activate exclusively | |
120 | on 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 |
123 | Gives the size of chunk for snapshot and thin pool logical volumes. |
124 | For snapshots the value must be power of 2 between 4KiB and 512KiB | |
125 | and the default value is 4. | |
126 | For thin pools the value must be power of 2 between 64KiB and | |
127 | 1048576KiB and the default value starts with 64 and scales | |
c63b155d | 128 | up to fit the pool metadata size within 128MB, |
34a45b00 ZK |
129 | if the poolmetadata size is not specified. |
130 | Default unit is in kilobytes. | |
922ce479 | 131 | .TP |
789fa12d | 132 | .BR \-C ", " \-\-contiguous " {" \fIy | \fIn } |
922ce479 AK |
133 | Sets or resets the contiguous allocation policy for |
134 | logical volumes. Default is no contiguous allocation based | |
135 | on a next free principle. | |
136 | .TP | |
789fa12d | 137 | .BR \-i ", " \-\-stripes " " \fIStripes |
922ce479 AK |
138 | Gives the number of stripes. |
139 | This is equal to the number of physical volumes to scatter | |
140 | the logical volume. | |
141 | .TP | |
789fa12d | 142 | .BR \-I ", " \-\-stripesize " " \fIStripeSize |
922ce479 AK |
143 | Gives the number of kilobytes for the granularity of the stripes. |
144 | .br | |
12de747d AK |
145 | StripeSize must be 2^n (n = 2 to 9) for metadata in LVM1 format. |
146 | For metadata in LVM2 format, the stripe size may be a larger | |
147 | power 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 |
150 | Gives the number of logical extents to allocate for the new |
151 | logical volume. | |
5bc2af26 | 152 | The number can also be expressed as a percentage of the total space |
789fa12d ZK |
153 | in the Volume Group with the suffix \fI%VG\fR, as a percentage of the |
154 | remaining free space in the Volume Group with the suffix \fI%FREE\fR, as a | |
5bc2af26 | 155 | percentage of the remaining free space for the specified |
789fa12d | 156 | PhysicalVolume(s) with the suffix \fI%PVS\fR, or (for a snapshot) as a |
5bc2af26 | 157 | percentage of the total space in the Origin Logical Volume with the |
789fa12d | 158 | suffix \fI%ORIGIN\fR. |
922ce479 | 159 | .TP |
789fa12d | 160 | .IR \fB\-L ", " \fB\-\-size " " LogicalVolumeSize [ bBsSkKmMgGtTpPeE ] |
922ce479 | 161 | Gives the size to allocate for the new logical volume. |
789fa12d ZK |
162 | A size suffix of \fIK\fR for kilobytes, \fIM\fR for megabytes, |
163 | \fIG\fR for gigabytes, \fIT\fR for terabytes, \fIP\fR for petabytes | |
164 | or \fIE\fR for exabytes is optional. | |
922ce479 AK |
165 | .br |
166 | Default unit is megabytes. | |
167 | .TP | |
789fa12d | 168 | .B \-\-minor \fIminor |
5a52dca9 AK |
169 | Set the minor number. |
170 | .TP | |
789fa12d | 171 | .IR \fB\-M ", " \fB\-\-persistent " {" y | n } |
5a52dca9 AK |
172 | Set to y to make the minor number specified persistent. |
173 | .TP | |
789fa12d | 174 | .BR \-m ", " \-\-mirrors " " \fIMirrors |
230948b9 | 175 | Creates a mirrored logical volume with Mirrors copies. For example, |
48432c88 AK |
176 | specifying "-m 1" would result in a mirror with two-sides; that is, a |
177 | linear volume plus one copy. | |
178 | ||
230948b9 | 179 | Specifying the optional argument --nosync will cause the creation |
48432c88 AK |
180 | of the mirror to skip the initial resynchronization. Any data written |
181 | afterwards will be mirrored, but the original contents will not be | |
182 | copied. This is useful for skipping a potentially long and resource | |
230948b9 | 183 | intensive initial sync of an empty device. |
48432c88 | 184 | |
230948b9 AK |
185 | The optional argument --mirrorlog specifies the type of log to be used. |
186 | The default is disk, which is persistent and requires | |
187 | a small amount of storage space, usually on a separate device from the | |
7a369d37 | 188 | data being mirrored. Using core means the mirror is regenerated |
230948b9 | 189 | by copying the data from the first device again each time the |
7a369d37 JEB |
190 | device is activated, for example, after every reboot. Using "mirrored" |
191 | will create a persistent log that is itself mirrored. | |
a6d4f21c | 192 | |
2b849ab4 | 193 | The 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 |
197 | The name for the new logical volume. |
198 | .br | |
199 | Without 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 |
203 | Disable udev synchronisation. The |
204 | process will not wait for notification from udev. | |
205 | It will continue irrespective of any possible udev processing | |
206 | in the background. You should only use this if udev is not running | |
207 | or has rules that ignore the devices LVM2 creates. | |
208 | .TP | |
789fa12d | 209 | .BR \-\-monitor " {" \fIy | \fIn } |
a6bc975a | 210 | Start or avoid monitoring a mirrored or snapshot logical volume with |
c63b155d | 211 | dmeventd, if it is installed. |
a6bc975a | 212 | If a device used by a monitored mirror reports an I/O error, |
c63b155d | 213 | the failure is handled according to |
a6bc975a MS |
214 | \fBmirror_image_fault_policy\fP and \fBmirror_log_fault_policy\fP |
215 | set in \fBlvm.conf\fP. | |
216 | .TP | |
789fa12d | 217 | .B \-\-ignoremonitoring |
a6bc975a MS |
218 | Make no attempt to interact with dmeventd unless \-\-monitor |
219 | is specified. | |
220 | .TP | |
789fa12d | 221 | .BR \-p ", " \-\-permission " {" \fIr | \fIrw } |
922ce479 AK |
222 | Set access permissions to read only or read and write. |
223 | .br | |
224 | Default is read and write. | |
7060c9d9 ZK |
225 | .TP |
226 | .IR \fB\-\-poolmetadatasize " " MetadataSize [ bBsSkKmMgG ] | |
227 | Set the size of thin pool's metadata logical volume. | |
228 | Supported value is in range between 2MiB and 16GiB. | |
229 | Default value is (Pool_LV_size / Pool_LV_chunk_size * 64b). | |
08525624 | 230 | Default unit is megabytes. |
922ce479 | 231 | .TP |
789fa12d | 232 | .IR \fB\-r ", " \fB\-\-readahead " {" ReadAheadSectors | auto | none } |
b4068515 AK |
233 | Set read ahead sector count of this logical volume. |
234 | For volume groups with metadata in lvm1 format, this must | |
235 | be a value between 2 and 120. | |
236 | The default value is "auto" which allows the kernel to choose | |
237 | a suitable value automatically. | |
238 | "None" is equivalent to specifying zero. | |
922ce479 | 239 | .TP |
789fa12d | 240 | .BR \-R ", " \-\-regionsize " " \fIMirrorLogRegionSize |
c63b155d | 241 | A mirror is divided into regions of this size (in MB), and the mirror log |
12ccdb25 AK |
242 | uses this granularity to track which regions are in sync. |
243 | .TP | |
43254b11 | 244 | .IR \fB\-s ", " \fB\-\-snapshot " " OriginalLogicalVolume { Name | Path } |
922ce479 AK |
245 | Create a snapshot logical volume (or snapshot) for an existing, so called |
246 | original logical volume (or origin). | |
247 | Snapshots provide a 'frozen image' of the contents of the origin | |
248 | while the origin can still be updated. They enable consistent | |
43254b11 ZK |
249 | backups and online recovery of removed/overwritten data/files. |
250 | Thin snapshot is created when the origin is a thin volume and | |
251 | the size is not specified. Thin snapshot shares same blocks within | |
252 | the thin pool volume. | |
253 | The snapshot with the specified size does not need the same amount of | |
254 | storage the origin has. In a typical scenario, 15-20% might be enough. | |
255 | In case the snapshot runs out of storage, use | |
789fa12d | 256 | .BR lvextend (8) |
922ce479 | 257 | to grow it. Shrinking a snapshot is supported by |
789fa12d | 258 | .BR lvreduce (8) |
922ce479 | 259 | as well. Run |
789fa12d | 260 | .BR lvdisplay (8) |
922ce479 | 261 | on the snapshot in order to check how much data is allocated to it. |
87f42fda | 262 | Note that a small amount of the space you allocate to the snapshot is |
c5185d4c | 263 | used to track the locations of the chunks of data, so you should |
87f42fda AK |
264 | allocate slightly more space than you actually need and monitor the |
265 | rate at which the snapshot data is growing so you can avoid running out | |
266 | of space. | |
267 | .TP | |
485cac0e | 268 | .IR \fB\-T ", " \fB\-\-thin ", " \fB\-\-thinpool " " ThinPoolLogicalVolume { Name | Path } |
7060c9d9 | 269 | Creates thin pool or thin logical volume or both. |
c63b155d | 270 | Specifying the optional argument \fB\-\-size\fP will cause the creation of |
7060c9d9 | 271 | the thin pool logical volume. |
c63b155d ZK |
272 | Specifying the optional argument \fB\-\-virtualsize\fP will cause |
273 | the creation of the thin logical volume from given thin pool volume. | |
7060c9d9 ZK |
274 | Specifying both arguments will cause the creation of both |
275 | thin pool and thin volume using this pool. | |
276 | Requires device mapper kernel driver for thin provisioning | |
277 | from kernel 3.2 or newer. | |
485cac0e ZK |
278 | .TP |
279 | .B \-\-type \fISegmentType | |
280 | Create a logical volume that uses the specified segment type | |
301e821d | 281 | (e.g. "raid5", "mirror", "snapshot", "thin", "thin-pool"). |
485cac0e | 282 | Many segment types have a |
c63b155d ZK |
283 | commandline switch alias that will enable their use |
284 | (\fB\-s\fP is an alias for \fB\-\-type snapshot\fP). | |
285 | However, this argument must be used when no existing | |
286 | commandline switch alias is available for the desired type, | |
287 | as 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 |
291 | Create a sparse device of the given size (in MB by default) using a snapshot |
292 | or thinly provisioned device when thin pool is specified. | |
154753db AK |
293 | Anything written to the device will be returned when reading from it. |
294 | Reading from other areas of the device will return blocks of zeros. | |
620ff9e9 | 295 | Virtual snapshot is implemented by creating a hidden virtual device of the |
87f42fda AK |
296 | requested size using the zero target. A suffix of _vorigin is used for |
297 | this device. | |
922ce479 | 298 | .TP |
789fa12d | 299 | .BR \-Z ", " \-\-zero " {" \fIy | \fIn } |
922ce479 AK |
300 | Controls zeroing of the first KB of data in the new logical volume. |
301 | .br | |
302 | Default is yes. | |
e0096cab MB |
303 | .br |
304 | Volume will not be zeroed if read only flag is set. | |
305 | .br | |
306 | Snapshot volumes are zeroed always. | |
922ce479 AK |
307 | |
308 | .br | |
309 | Warning: trying to mount an unzeroed logical volume can cause the system to | |
310 | hang. | |
311 | .SH Examples | |
c63b155d | 312 | Creates a striped logical volume with 3 stripes, a stripesize of 8KB |
070f7171 ZK |
313 | and a size of 100MB in the volume group named vg00. |
314 | The logical volume name will be chosen by lvcreate: | |
315 | .sp | |
c63b155d | 316 | .B lvcreate \-i 3 \-I 8 \-L 100M vg00 |
922ce479 | 317 | |
070f7171 | 318 | Creates a mirror logical volume with 2 sides with a useable size of 500 MiB. |
c63b155d ZK |
319 | This operation would require 3 devices (or option --alloc anywhere) - two |
320 | for the mirror devices and one for the disk log: | |
070f7171 | 321 | .sp |
c63b155d | 322 | .B lvcreate \-m1 \-L 500M vg00 |
48432c88 | 323 | |
070f7171 | 324 | Creates a mirror logical volume with 2 sides with a useable size of 500 MiB. |
c63b155d | 325 | This 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 | 329 | Creates a snapshot logical volume named /dev/vg00/snap which has access to the |
922ce479 AK |
330 | contents of the original logical volume named /dev/vg00/lvol1 |
331 | at snapshot logical volume creation time. If the original logical volume | |
332 | contains a file system, you can mount the snapshot logical volume on an | |
333 | arbitrary directory in order to access the contents of the filesystem to run | |
c63b155d | 334 | a 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 |
338 | Creates a sparse device named /dev/vg1/sparse of size 1TiB with space for just |
339 | under 100MiB of actual data on it: | |
070f7171 | 340 | .sp |
c63b155d | 341 | .B lvcreate \-\-virtualsize 1T \-\-size 100M \-\-snapshot \-\-name sparse vg1 |
c808baef | 342 | |
070f7171 | 343 | Creates 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 | 348 | Creates a 5GiB RAID5 logical volume "vg00/my_lv", with 3 stripes (plus |
c63b155d | 349 | a 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 |
353 | Creates 100MiB pool logical volume for thin provisioning |
354 | build with 2 stripes 64KiB and chunk size 128KiB together with | |
c63b155d | 355 | 1TiB 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) |