Import lvm2 from NetBSD
[dragonfly.git] / contrib / lvm2 / dist / man / lvcreate.8.in
1 .TH LVCREATE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
2 .SH NAME
3 lvcreate \- create a logical volume in an existing volume group
4 .SH SYNOPSIS
5 .B lvcreate
6 [\-\-addtag Tag]
7 [\-\-alloc AllocationPolicy]
8 [\-A|\-\-autobackup y|n] [\-C|\-\-contiguous y|n] [\-d|\-\-debug]
9 [\-h|\-?|\-\-help] [\-\-noudevsync]
10 [\-i|\-\-stripes Stripes [\-I|\-\-stripesize StripeSize]]
11 {\-l|\-\-extents LogicalExtentsNumber[%{VG|PVS|FREE}] |
12  \-L|\-\-size LogicalVolumeSize[bBsSkKmMgGtTpPeE]}
13 [\-M|\-\-persistent y|n] [\-\-minor minor]
14 [\-m|\-\-mirrors Mirrors [\-\-nosync] [\-\-mirrorlog {disk|core}] [\-\-corelog]
15 [\-R|\-\-regionsize MirrorLogRegionSize]]
16 [\-n|\-\-name LogicalVolumeName]
17 [\-p|\-\-permission r|rw] [\-r|\-\-readahead ReadAheadSectors|auto|none]
18 [\-t|\-\-test]
19 [\-v|\-\-verbose] [\-Z|\-\-zero y|n]
20 VolumeGroupName [PhysicalVolumePath[:PE[-PE]]...]
21 .br
22
23 .br
24 .B lvcreate
25 {\-l|\-\-extents LogicalExtentsNumber[%{VG|FREE}] |
26  \-L|\-\-size LogicalVolumeSize[bBsSkKmMgGtTpPeE]}
27 [\-c|\-\-chunksize ChunkSize]
28 [\-\-noudevsync]
29 \-n|\-\-name SnapshotLogicalVolumeName
30 {{\-s|\-\-snapshot}
31 OriginalLogicalVolumePath | 
32 [\-s|\-\-snapshot]
33 VolumeGroupName \-\-virtualsize VirtualSize}
34 .SH DESCRIPTION
35 lvcreate creates a new logical volume in a volume group ( see
36 .B vgcreate(8), vgchange(8)
37 ) by allocating logical extents from the free physical extent pool
38 of that volume group.  If there are not enough free physical extents then
39 the volume group can be extended ( see
40 .B vgextend(8)
41 ) with other physical volumes or by reducing existing logical volumes
42 of this volume group in size ( see
43 .B lvreduce(8)
44 ). If you specify one or more PhysicalVolumes, allocation of physical
45 extents will be restricted to these volumes.
46 .br
47 .br
48 The second form supports the creation of snapshot logical volumes which 
49 keep the contents of the original logical volume for backup purposes.
50 .SH OPTIONS
51 See \fBlvm\fP for common options.
52 .TP
53 .I \-c, \-\-chunksize ChunkSize
54 Power of 2 chunk size for the snapshot logical volume between 4k and 512k.
55 .TP
56 .I \-C, \-\-contiguous y|n
57 Sets or resets the contiguous allocation policy for
58 logical volumes. Default is no contiguous allocation based
59 on a next free principle.
60 .TP
61 .I \-i, \-\-stripes Stripes
62 Gives the number of stripes.
63 This is equal to the number of physical volumes to scatter
64 the logical volume.
65 .TP
66 .I \-I, \-\-stripesize StripeSize
67 Gives the number of kilobytes for the granularity of the stripes.
68 .br
69 StripeSize must be 2^n (n = 2 to 9) for metadata in LVM1 format.
70 For metadata in LVM2 format, the stripe size may be a larger
71 power of 2 but must not exceed the physical extent size.
72 .TP
73 .I \-l, \-\-extents LogicalExtentsNumber[%{VG|PVS|FREE}]
74 Gives the number of logical extents to allocate for the new
75 logical volume.
76 This can also be expressed as a percentage of the total space
77 in the Volume Group with the suffix %VG, of the remaining
78 free space in the Volume Group with the suffix %FREE, or
79 of the remaining free space for the specified PhysicalVolume(s)
80 with the suffix %PVS,
81 .TP
82 .I \-L, \-\-size LogicalVolumeSize[bBsSkKmMgGtTpPeE]
83 Gives the size to allocate for the new logical volume.
84 A size suffix of K for kilobytes, M for megabytes,
85 G for gigabytes, T for terabytes, P for petabytes
86 or E for exabytes is optional.
87 .br
88 Default unit is megabytes.
89 .TP
90 .I \-\-minor minor
91 Set the minor number.
92 .TP
93 .I \-M, \-\-persistent y|n
94 Set to y to make the minor number specified persistent.
95 .TP
96 .I \-m, \-\-mirrors Mirrors
97 Creates a mirrored logical volume with Mirrors copies.  For example,
98 specifying "-m 1" would result in a mirror with two-sides; that is, a
99 linear volume plus one copy.
100
101 Specifying the optional argument --nosync will cause the creation
102 of the mirror to skip the initial resynchronization.  Any data written
103 afterwards will be mirrored, but the original contents will not be
104 copied.  This is useful for skipping a potentially long and resource
105 intensive initial sync of an empty device.
106
107 The optional argument --mirrorlog specifies the type of log to be used.
108 The default is disk, which is persistent and requires
109 a small amount of storage space, usually on a separate device from the
110 data being mirrored. Using core means the mirror is regenerated
111 by copying the data from the first device again each time the
112 device is activated, for example, after every reboot.
113
114 The optional argument --corelog is equivalent to --mirrorlog core.
115
116 .TP
117 .I \-n, \-\-name LogicalVolumeName
118 The name for the new logical volume.
119 .br
120 Without this option a default names of "lvol#" will be generated where
121 # is the LVM internal number of the logical volume.
122 .TP
123 .I \-\-noudevsync
124 Disable udev synchronisation. The
125 process will not wait for notification from udev.
126 It will continue irrespective of any possible udev processing
127 in the background.  You should only use this if udev is not running
128 or has rules that ignore the devices LVM2 creates.
129 .TP
130 .I \-p, \-\-permission r|rw
131 Set access permissions to read only or read and write.
132 .br
133 Default is read and write.
134 .TP
135 .I \-r, \-\-readahead ReadAheadSectors|auto|none
136 Set read ahead sector count of this logical volume.
137 For volume groups with metadata in lvm1 format, this must
138 be a value between 2 and 120.
139 The default value is "auto" which allows the kernel to choose
140 a suitable value automatically.
141 "None" is equivalent to specifying zero.
142 .TP
143 .I \-R, \-\-regionsize MirrorLogRegionSize
144 A mirror is divided into regions of this size (in MB), and the mirror log 
145 uses this granularity to track which regions are in sync.
146 .TP
147 .I \-s, \-\-snapshot
148 Create a snapshot logical volume (or snapshot) for an existing, so called
149 original logical volume (or origin).
150 Snapshots provide a 'frozen image' of the contents of the origin
151 while the origin can still be updated. They enable consistent
152 backups and online recovery of removed/overwritten data/files. The snapshot
153 does not need the same amount of storage the origin has. In a typical scenario,
154 15-20% might be enough. In case the snapshot runs out of storage, use
155 .B lvextend(8)
156 to grow it. Shrinking a snapshot is supported by
157 .B lvreduce(8)
158 as well. Run
159 .B lvdisplay(8)
160 on the snapshot in order to check how much data is allocated to it.
161 Note that a small amount of the space you allocate to the snapshot is
162 used to track the locations of the chunks of data, so you should
163 allocate slightly more space than you actually need and monitor the
164 rate at which the snapshot data is growing so you can avoid running out
165 of space.
166 .TP
167 .I \-\-virtualsize VirtualSize
168 Create a sparse device of the given size (in MB by default) using a snapshot.  
169 Anything written to the device will be returned when reading from it.
170 Reading from other areas of the device will return blocks of zeros.
171 It is implemented by creating a hidden virtual device of the
172 requested size using the zero target.  A suffix of _vorigin is used for
173 this device.
174 .TP
175 .I \-Z, \-\-zero y|n
176 Controls zeroing of the first KB of data in the new logical volume.
177 .br
178 Default is yes.
179 .br
180 Volume will not be zeroed if read only flag is set.
181 .br
182 Snapshot volumes are zeroed always.
183
184 .br
185 Warning: trying to mount an unzeroed logical volume can cause the system to
186 hang.
187 .SH Examples
188 "lvcreate -i 3 -I 8 -L 100M vg00" tries to create a striped logical
189 volume with 3 stripes, a stripesize of 8KB and a size of 100MB in the volume
190 group named vg00. The logical volume name will be chosen by lvcreate.
191
192 "lvcreate -m1 -L 500M vg00" tries to create a mirror logical volume
193 with 2 sides with a useable size of 500 MiB.  This operation would
194 require 3 devices - two for the mirror devices and one for the disk
195 log.
196
197 "lvcreate -m1 --mirrorlog core -L 500M vg00" tries to create a mirror logical volume
198 with 2 sides with a useable size of 500 MiB.  This operation would
199 require 2 devices - the log is "in-memory".
200
201 "lvcreate --size 100m --snapshot --name snap /dev/vg00/lvol1"
202 .br
203 creates a snapshot logical volume named /dev/vg00/snap which has access to the
204 contents of the original logical volume named /dev/vg00/lvol1
205 at snapshot logical volume creation time. If the original logical volume
206 contains a file system, you can mount the snapshot logical volume on an
207 arbitrary directory in order to access the contents of the filesystem to run
208 a backup while the original filesystem continues to get updated.
209
210 "lvcreate --virtualsize 1T --size 100M --snapshot --name sparse vg1"
211 .br
212 creates a sparse device named /dev/vg1/sparse of size 1TB with space for just
213 under 100MB of actual data on it.
214 .br
215
216 "lvcreate -L 64M -n lvol1 vg00 /dev/sda:0-7 /dev/sdb:0-7"
217 .br
218 creates a linear logical volume "vg00/lvol1" using physical extents
219 /dev/sda:0-7 and /dev/sdb:0-7 for allocation of extents.
220
221
222 .SH SEE ALSO
223 .BR lvm (8), 
224 .BR vgcreate (8), 
225 .BR lvremove (8), 
226 .BR lvrename (8)
227 .BR lvextend (8), 
228 .BR lvreduce (8), 
229 .BR lvdisplay (8), 
230 .BR lvscan (8)